1namespace ts { 2 // https://github.com/microsoft/TypeScript/issues/31696 3 describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { 4 verifyTsc({ 5 scenario: "moduleSpecifiers", 6 subScenario: `synthesized module specifiers resolve correctly`, 7 fs: () => loadProjectFromFiles({ 8 "/src/solution/common/nominal.ts": Utils.dedent` 9 export declare type Nominal<T, Name extends string> = T & { 10 [Symbol.species]: Name; 11 }; 12 `, 13 "/src/solution/common/tsconfig.json": Utils.dedent` 14 { 15 "extends": "../../tsconfig.base.json", 16 "compilerOptions": { 17 "composite": true 18 }, 19 "include": ["nominal.ts"] 20 }`, 21 "/src/solution/sub-project/index.ts": Utils.dedent` 22 import { Nominal } from '../common/nominal'; 23 24 export type MyNominal = Nominal<string, 'MyNominal'>; 25 `, 26 "/src/solution/sub-project/tsconfig.json": Utils.dedent` 27 { 28 "extends": "../../tsconfig.base.json", 29 "compilerOptions": { 30 "composite": true 31 }, 32 "references": [ 33 { "path": "../common" } 34 ], 35 "include": ["./index.ts"] 36 }`, 37 "/src/solution/sub-project-2/index.ts": Utils.dedent` 38 import { MyNominal } from '../sub-project/index'; 39 40 const variable = { 41 key: 'value' as MyNominal, 42 }; 43 44 export function getVar(): keyof typeof variable { 45 return 'key'; 46 } 47 `, 48 "/src/solution/sub-project-2/tsconfig.json": Utils.dedent` 49 { 50 "extends": "../../tsconfig.base.json", 51 "compilerOptions": { 52 "composite": true 53 }, 54 "references": [ 55 { "path": "../sub-project" } 56 ], 57 "include": ["./index.ts"] 58 }`, 59 "/src/solution/tsconfig.json": Utils.dedent` 60 { 61 "compilerOptions": { 62 "composite": true 63 }, 64 "references": [ 65 { "path": "./sub-project" }, 66 { "path": "./sub-project-2" } 67 ], 68 "include": [] 69 }`, 70 "/src/tsconfig.base.json": Utils.dedent` 71 { 72 "compilerOptions": { 73 "skipLibCheck": true, 74 "rootDir": "./", 75 "outDir": "lib", 76 } 77 }`, 78 "/src/tsconfig.json": Utils.dedent`{ 79 "compilerOptions": { 80 "composite": true 81 }, 82 "references": [ 83 { "path": "./solution" } 84 ], 85 "include": [] 86 }` 87 }, symbolLibContent), 88 commandLineArgs: ["-b", "/src", "--verbose"] 89 }); 90 }); 91} 92