Skip to content

Commit 4ea628e

Browse files
committed
Test to show even when typeRoots are specified, resolution falls back to node_modules in nearest directory
1 parent 1c2318d commit 4ea628e

5 files changed

+63
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//// [tests/cases/compiler/typeReferenceDirectiveWithFailedFromTypeRoot.ts] ////
2+
3+
//// [dummy.d.ts]
4+
declare const a2: number;
5+
6+
//// [phaser.d.ts]
7+
declare const a: number;
8+
9+
//// [package.json]
10+
{ "name": "phaser", "version": "1.2.3", "types": "types/phaser.d.ts" }
11+
12+
//// [a.ts]
13+
a;
14+
15+
//// [a.js]
16+
a;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== /a.ts ===
2+
a;
3+
>a : Symbol(a, Decl(phaser.d.ts, 0, 13))
4+
5+
=== /node_modules/phaser/types/phaser.d.ts ===
6+
declare const a: number;
7+
>a : Symbol(a, Decl(phaser.d.ts, 0, 13))
8+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
"======== Resolving type reference directive 'phaser', containing file '/__inferred type names__.ts', root directory '/typings'. ========",
3+
"Resolving with primary search path '/typings'.",
4+
"File '/typings/phaser.d.ts' does not exist.",
5+
"Looking up in 'node_modules' folder, initial location '/'.",
6+
"Found 'package.json' at '/node_modules/phaser/package.json'.",
7+
"'package.json' does not have a 'typesVersions' field.",
8+
"File '/node_modules/phaser.d.ts' does not exist.",
9+
"'package.json' does not have a 'typings' field.",
10+
"'package.json' has 'types' field 'types/phaser.d.ts' that references '/node_modules/phaser/types/phaser.d.ts'.",
11+
"File '/node_modules/phaser/types/phaser.d.ts' exist - use it as a name resolution result.",
12+
"Resolving real path for '/node_modules/phaser/types/phaser.d.ts', result '/node_modules/phaser/types/phaser.d.ts'.",
13+
"======== Type reference directive 'phaser' was successfully resolved to '/node_modules/phaser/types/phaser.d.ts' with Package ID 'phaser/types/[email protected]', primary: false. ========"
14+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== /a.ts ===
2+
a;
3+
>a : number
4+
5+
=== /node_modules/phaser/types/phaser.d.ts ===
6+
declare const a: number;
7+
>a : number
8+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @noImplicitReferences: true
2+
// @typeRoots: /typings
3+
// @types: phaser
4+
// @traceResolution: true
5+
// @currentDirectory: /
6+
7+
// @Filename: /typings/dummy.d.ts
8+
declare const a2: number;
9+
10+
// @Filename: /node_modules/phaser/types/phaser.d.ts
11+
declare const a: number;
12+
13+
// @Filename: /node_modules/phaser/package.json
14+
{ "name": "phaser", "version": "1.2.3", "types": "types/phaser.d.ts" }
15+
16+
// @Filename: /a.ts
17+
a;

0 commit comments

Comments
 (0)