@@ -91,6 +91,68 @@ describe("unittests:: tsbuild:: moduleResolution:: handles the modules and optio
9191 } ) ,
9292 commandLineArgs : [ "-b" , "packages/pkg1.tsconfig.json" , "packages/pkg2.tsconfig.json" , "--verbose" , "--traceResolution" ] ,
9393 } ) ;
94+
95+ verifyTsc ( {
96+ scenario : "moduleResolution" ,
97+ subScenario : "resolution from d.ts of referenced project" ,
98+ sys : ( ) =>
99+ TestServerHost . createWatchedSystem ( {
100+ "/home/src/workspaces/project/common.d.ts" : "export type OnValue = (value: number) => void" ,
101+ "/home/src/workspaces/project/producer/index.ts" : dedent `
102+ export { ValueProducerDeclaration } from "./in-js"
103+ import { OnValue } from "@common"
104+ export interface ValueProducerFromTs {
105+ onValue: OnValue;
106+ }
107+ ` ,
108+ "/home/src/workspaces/project/producer/in-js.d.ts" : dedent `
109+ import { OnValue } from "@common"
110+ export interface ValueProducerDeclaration {
111+ onValue: OnValue;
112+ }
113+ ` ,
114+ "/home/src/workspaces/project/producer/tsconfig.json" : jsonToReadableText ( {
115+ compilerOptions : {
116+ strict : true ,
117+ composite : true ,
118+ module : "nodenext" ,
119+ moduleResolution : "nodenext" ,
120+ paths : {
121+ "@common" : [ "../common.d.ts" ] ,
122+ } ,
123+ libReplacement : false ,
124+ } ,
125+ } ) ,
126+ "/home/src/workspaces/project/consumer/index.ts" : dedent `
127+ import { ValueProducerDeclaration, ValueProducerFromTs } from "@producer"
128+ declare let v: ValueProducerDeclaration;
129+ // n is implicitly any because onValue is actually any (despite what the tooltip says)
130+ v.onValue = (n) => {
131+
132+ }
133+
134+ // n is implicitly number as expected
135+ declare let v2: ValueProducerFromTs;
136+ v2.onValue = (n) => {
137+
138+ }` ,
139+ "/home/src/workspaces/project/consumer/tsconfig.json" : jsonToReadableText ( {
140+ compilerOptions : {
141+ strict : true ,
142+ module : "nodenext" ,
143+ moduleResolution : "nodenext" ,
144+ paths : {
145+ "@producer" : [ "../producer/index" ] ,
146+ } ,
147+ libReplacement : false ,
148+ } ,
149+ references : [
150+ { path : "../producer" } ,
151+ ] ,
152+ } ) ,
153+ } ) ,
154+ commandLineArgs : [ "--b" , "consumer" , "--traceResolution" , "-v" ] ,
155+ } ) ;
94156} ) ;
95157
96158describe ( "unittests:: tsbuild:: moduleResolution:: impliedNodeFormat differs between projects for shared file" , ( ) => {
0 commit comments