Skip to content

Commit

Permalink
Update showing fix in #44004 works
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed May 8, 2021
1 parent 8da9ed0 commit 5c1ae7a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/compiler/tsbuildPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ namespace ts {
state.projectCompilerOptions = config.options;
// Update module resolution cache if needed
state.moduleResolutionCache?.update(config.options);
// state.typeReferenceDirectiveResolutionCache?.update(config.options);
state.typeReferenceDirectiveResolutionCache?.update(config.options);

// Create program
program = host.createProgram(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const theNum: TheNum2 = "type2";
declare type TheNum = "type1";

//// [/src/packages/typeroot2/sometype/index.d.ts]

declare type TheNum2 = "type2";



Expand All @@ -54,18 +54,13 @@ Resolving real path for '/src/packages/typeroot1/sometype/index.d.ts', result '/

[12:00:00 AM] Building project '/src/packages/pkg2.tsconfig.json'...

======== Resolving type reference directive 'sometype', containing file '/src/packages/__inferred type names__.ts'. ========
Resolution for type reference directive 'sometype' was found in cache from location '/src/packages'.
======== Type reference directive 'sometype' was successfully resolved to '/src/packages/typeroot1/sometype/index.d.ts', primary: true. ========
src/packages/pkg2_index.ts:1:22 - error TS2304: Cannot find name 'TheNum2'.

1 export const theNum: TheNum2 = "type2";
   ~~~~~~~


Found 1 error.

exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
======== Resolving type reference directive 'sometype', containing file '/src/packages/__inferred type names__.ts', root directory '/src/packages/typeroot2'. ========
Resolving with primary search path '/src/packages/typeroot2'.
File '/src/packages/typeroot2/sometype/package.json' does not exist.
File '/src/packages/typeroot2/sometype/index.d.ts' exist - use it as a name resolution result.
Resolving real path for '/src/packages/typeroot2/sometype/index.d.ts', result '/src/packages/typeroot2/sometype/index.d.ts'.
======== Type reference directive 'sometype' was successfully resolved to '/src/packages/typeroot2/sometype/index.d.ts', primary: true. ========
exitCode:: ExitStatus.Success


//// [/src/packages/pkg1.tsconfig.tsbuildinfo]
Expand Down Expand Up @@ -123,15 +118,15 @@ exports.theNum = "type1";


//// [/src/packages/pkg2.tsconfig.tsbuildinfo]
{"program":{"fileNames":["../../lib/lib.d.ts","./pkg2_index.ts","./typeroot1/sometype/index.d.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-12823281204-export const theNum: TheNum2 = \"type2\";",{"version":"-4557394441-declare type TheNum = \"type1\";","affectsGlobalScope":true}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,[2,[{"file":"./pkg2_index.ts","start":21,"length":7,"messageText":"Cannot find name 'TheNum2'.","category":1,"code":2304}]],3],"affectedFilesPendingEmit":[[2,1],[3,1]]},"version":"FakeTSVersion"}
{"program":{"fileNames":["../../lib/lib.d.ts","./pkg2_index.ts","./typeroot2/sometype/index.d.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"-12823281204-export const theNum: TheNum2 = \"type2\";",{"version":"-980425686-declare type TheNum2 = \"type2\";","affectsGlobalScope":true}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3]},"version":"FakeTSVersion"}

//// [/src/packages/pkg2.tsconfig.tsbuildinfo.readable.baseline.txt]
{
"program": {
"fileNames": [
"../../lib/lib.d.ts",
"./pkg2_index.ts",
"./typeroot1/sometype/index.d.ts"
"./typeroot2/sometype/index.d.ts"
],
"fileInfos": {
"../../lib/lib.d.ts": {
Expand All @@ -143,9 +138,9 @@ exports.theNum = "type1";
"version": "-12823281204-export const theNum: TheNum2 = \"type2\";",
"signature": "-12823281204-export const theNum: TheNum2 = \"type2\";"
},
"./typeroot1/sometype/index.d.ts": {
"version": "-4557394441-declare type TheNum = \"type1\";",
"signature": "-4557394441-declare type TheNum = \"type1\";",
"./typeroot2/sometype/index.d.ts": {
"version": "-980425686-declare type TheNum2 = \"type2\";",
"signature": "-980425686-declare type TheNum2 = \"type2\";",
"affectsGlobalScope": true
}
},
Expand All @@ -156,33 +151,23 @@ exports.theNum = "type1";
"exportedModulesMap": {},
"semanticDiagnosticsPerFile": [
"../../lib/lib.d.ts",
[
"./pkg2_index.ts",
[
{
"file": "./pkg2_index.ts",
"start": 21,
"length": 7,
"messageText": "Cannot find name 'TheNum2'.",
"category": 1,
"code": 2304
}
]
],
"./typeroot1/sometype/index.d.ts"
],
"affectedFilesPendingEmit": [
[
"./pkg2_index.ts",
"Full"
],
[
"./typeroot1/sometype/index.d.ts",
"Full"
]
"./pkg2_index.ts",
"./typeroot2/sometype/index.d.ts"
]
},
"version": "FakeTSVersion",
"size": 1033
"size": 870
}

//// [/src/packages/pkg2_index.d.ts]
/// <reference types="sometype" />
export declare const theNum: TheNum2;


//// [/src/packages/pkg2_index.js]
"use strict";
exports.__esModule = true;
exports.theNum = void 0;
exports.theNum = "type2";


0 comments on commit 5c1ae7a

Please sign in to comment.