@@ -69,5 +69,68 @@ namespace ts {
6969 } ,
7070 commandLineArgs : [ "-p" , "src/plugin-one" , "--listFiles" ]
7171 } ) ;
72+
73+ verifyTsc ( {
74+ scenario : "declarationEmit" ,
75+ subScenario : "when pkg references sibling package through indirect symlink" ,
76+ fs : ( ) => loadProjectFromFiles ( {
77+ "/src/pkg1/dist/index.d.ts" : utils . dedent `
78+ export * from './types';` ,
79+ "/src/pkg1/dist/types.d.ts" : utils . dedent `
80+ export declare type A = {
81+ id: string;
82+ };
83+ export declare type B = {
84+ id: number;
85+ };
86+ export declare type IdType = A | B;
87+ export declare class MetadataAccessor<T, D extends IdType = IdType> {
88+ readonly key: string;
89+ private constructor();
90+ toString(): string;
91+ static create<T, D extends IdType = IdType>(key: string): MetadataAccessor<T, D>;
92+ }` ,
93+ "/src/pkg1/package.json" : utils . dedent `
94+ {
95+ "name": "@raymondfeng/pkg1",
96+ "version": "1.0.0",
97+ "description": "",
98+ "main": "dist/index.js",
99+ "typings": "dist/index.d.ts"
100+ }` ,
101+ "/src/pkg2/dist/index.d.ts" : utils . dedent `
102+ export * from './types';` ,
103+ "/src/pkg2/dist/types.d.ts" : utils . dedent `
104+ export {MetadataAccessor} from '@raymondfeng/pkg1';` ,
105+ "/src/pkg2/package.json" : utils . dedent `
106+ {
107+ "name": "@raymondfeng/pkg2",
108+ "version": "1.0.0",
109+ "description": "",
110+ "main": "dist/index.js",
111+ "typings": "dist/index.d.ts"
112+ }` ,
113+ "/src/pkg3/src/index.ts" : utils . dedent `
114+ export * from './keys';` ,
115+ "/src/pkg3/src/keys.ts" : utils . dedent `
116+ import {MetadataAccessor} from "@raymondfeng/pkg2";
117+ export const ADMIN = MetadataAccessor.create<boolean>('1');` ,
118+ "/src/pkg3/tsconfig.json" : utils . dedent `
119+ {
120+ "compilerOptions": {
121+ "outDir": "dist",
122+ "rootDir": "src",
123+ "target": "es5",
124+ "module": "commonjs",
125+ "strict": true,
126+ "esModuleInterop": true,
127+ "declaration": true
128+ }
129+ }` ,
130+ "/src/pkg2/node_modules/@raymondfeng/pkg1" : new vfs . Symlink ( "/src/pkg1" ) ,
131+ "/src/pkg3/node_modules/@raymondfeng/pkg2" : new vfs . Symlink ( "/src/pkg2" ) ,
132+ } ) ,
133+ commandLineArgs : [ "-p" , "src/pkg3" , "--listFiles" ]
134+ } ) ;
72135 } ) ;
73136}
0 commit comments