Skip to content

Commit 1797869

Browse files
committed
Add a failing test case with types: null condition
1 parent cbb8dfe commit 1797869

5 files changed

+276
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error TS6504: File '/node_modules/foo/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
2+
The file is in the program because:
3+
Root file specified for compilation
4+
5+
6+
!!! error TS6504: File '/node_modules/foo/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
7+
!!! error TS6504: The file is in the program because:
8+
!!! error TS6504: Root file specified for compilation
9+
==== /node_modules/foo/package.json (0 errors) ====
10+
{
11+
"name": "foo",
12+
"version": "1.0.0",
13+
"exports": {
14+
"types": null,
15+
"require": "./index.js"
16+
}
17+
}
18+
19+
==== /node_modules/foo/index.js (0 errors) ====
20+
module.exports = { a: 'a' };
21+
22+
==== /node_modules/foo/index.d.ts (0 errors) ====
23+
export declare const a: 'a'
24+
25+
==== /a.ts (0 errors) ====
26+
export { a } from "foo";
27+
28+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
[
2+
"Found 'package.json' at '/node_modules/foo/package.json'.",
3+
"File '/package.json' does not exist.",
4+
"======== Resolving module 'foo' from '/a.ts'. ========",
5+
"Explicitly specified module resolution kind: 'Node16'.",
6+
"Resolving in CJS mode with conditions 'require', 'types', 'node'.",
7+
"File '/package.json' does not exist according to earlier cached lookups.",
8+
"Loading module 'foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.",
9+
"File '/node_modules/foo/package.json' exists according to earlier cached lookups.",
10+
"Entering conditional exports.",
11+
"Matched 'exports' condition 'types'.",
12+
"package.json scope '/node_modules/foo' explicitly maps specifier '.' to null.",
13+
"Failed to resolve under condition 'types'.",
14+
"Matched 'exports' condition 'require'.",
15+
"Using 'exports' subpath '.' with target './index.js'.",
16+
"File name '/node_modules/foo/index.js' has a '.js' extension - stripping it.",
17+
"File '/node_modules/foo/index.ts' does not exist.",
18+
"File '/node_modules/foo/index.tsx' does not exist.",
19+
"File '/node_modules/foo/index.d.ts' exists - use it as a name resolution result.",
20+
"Resolved under condition 'require'.",
21+
"Exiting conditional exports.",
22+
"Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'.",
23+
"======== Module name 'foo' was successfully resolved to '/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.0.0'. ========",
24+
"File 'package.json' does not exist.",
25+
"File '/package.json' does not exist according to earlier cached lookups.",
26+
"======== Resolving module '@typescript/lib-es5' from '__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========",
27+
"Explicitly specified module resolution kind: 'Node10'.",
28+
"Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.",
29+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
30+
"Scoped package detected, looking in 'typescript__lib-es5'",
31+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
32+
"Scoped package detected, looking in 'typescript__lib-es5'",
33+
"Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.",
34+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
35+
"======== Module name '@typescript/lib-es5' was not resolved. ========",
36+
"File 'package.json' does not exist according to earlier cached lookups.",
37+
"File '/package.json' does not exist according to earlier cached lookups.",
38+
"======== Resolving module '@typescript/lib-decorators' from '__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========",
39+
"Explicitly specified module resolution kind: 'Node10'.",
40+
"Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.",
41+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
42+
"Scoped package detected, looking in 'typescript__lib-decorators'",
43+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
44+
"Scoped package detected, looking in 'typescript__lib-decorators'",
45+
"Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.",
46+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
47+
"======== Module name '@typescript/lib-decorators' was not resolved. ========",
48+
"File 'package.json' does not exist according to earlier cached lookups.",
49+
"File '/package.json' does not exist according to earlier cached lookups.",
50+
"======== Resolving module '@typescript/lib-decorators/legacy' from '__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========",
51+
"Explicitly specified module resolution kind: 'Node10'.",
52+
"Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.",
53+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
54+
"Scoped package detected, looking in 'typescript__lib-decorators/legacy'",
55+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
56+
"Scoped package detected, looking in 'typescript__lib-decorators/legacy'",
57+
"Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.",
58+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
59+
"======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========",
60+
"File 'package.json' does not exist according to earlier cached lookups.",
61+
"File '/package.json' does not exist according to earlier cached lookups.",
62+
"======== Resolving module '@typescript/lib-dom' from '__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
63+
"Explicitly specified module resolution kind: 'Node10'.",
64+
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
65+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
66+
"Scoped package detected, looking in 'typescript__lib-dom'",
67+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
68+
"Scoped package detected, looking in 'typescript__lib-dom'",
69+
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.",
70+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
71+
"======== Module name '@typescript/lib-dom' was not resolved. ========",
72+
"File 'package.json' does not exist according to earlier cached lookups.",
73+
"File '/package.json' does not exist according to earlier cached lookups.",
74+
"======== Resolving module '@typescript/lib-webworker/importscripts' from '__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========",
75+
"Explicitly specified module resolution kind: 'Node10'.",
76+
"Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.",
77+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
78+
"Scoped package detected, looking in 'typescript__lib-webworker/importscripts'",
79+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
80+
"Scoped package detected, looking in 'typescript__lib-webworker/importscripts'",
81+
"Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.",
82+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
83+
"======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========",
84+
"File 'package.json' does not exist according to earlier cached lookups.",
85+
"File '/package.json' does not exist according to earlier cached lookups.",
86+
"======== Resolving module '@typescript/lib-scripthost' from '__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========",
87+
"Explicitly specified module resolution kind: 'Node10'.",
88+
"Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.",
89+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
90+
"Scoped package detected, looking in 'typescript__lib-scripthost'",
91+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
92+
"Scoped package detected, looking in 'typescript__lib-scripthost'",
93+
"Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.",
94+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
95+
"======== Module name '@typescript/lib-scripthost' was not resolved. ========",
96+
"File 'package.json' does not exist according to earlier cached lookups.",
97+
"File '/package.json' does not exist according to earlier cached lookups."
98+
]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error TS6504: File '/node_modules/foo/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
2+
The file is in the program because:
3+
Root file specified for compilation
4+
5+
6+
!!! error TS6504: File '/node_modules/foo/index.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
7+
!!! error TS6504: The file is in the program because:
8+
!!! error TS6504: Root file specified for compilation
9+
==== /node_modules/foo/package.json (0 errors) ====
10+
{
11+
"name": "foo",
12+
"version": "1.0.0",
13+
"exports": {
14+
"types": null,
15+
"require": "./index.js"
16+
}
17+
}
18+
19+
==== /node_modules/foo/index.js (0 errors) ====
20+
module.exports = { a: 'a' };
21+
22+
==== /node_modules/foo/index.d.ts (0 errors) ====
23+
export declare const a: 'a'
24+
25+
==== /a.ts (0 errors) ====
26+
export { a } from "foo";
27+
28+
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
[
2+
"Found 'package.json' at '/node_modules/foo/package.json'.",
3+
"File '/package.json' does not exist.",
4+
"======== Resolving module 'foo' from '/a.ts'. ========",
5+
"Explicitly specified module resolution kind: 'NodeNext'.",
6+
"Resolving in CJS mode with conditions 'require', 'types', 'node'.",
7+
"File '/package.json' does not exist according to earlier cached lookups.",
8+
"Loading module 'foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration.",
9+
"File '/node_modules/foo/package.json' exists according to earlier cached lookups.",
10+
"Entering conditional exports.",
11+
"Matched 'exports' condition 'types'.",
12+
"package.json scope '/node_modules/foo' explicitly maps specifier '.' to null.",
13+
"Failed to resolve under condition 'types'.",
14+
"Matched 'exports' condition 'require'.",
15+
"Using 'exports' subpath '.' with target './index.js'.",
16+
"File name '/node_modules/foo/index.js' has a '.js' extension - stripping it.",
17+
"File '/node_modules/foo/index.ts' does not exist.",
18+
"File '/node_modules/foo/index.tsx' does not exist.",
19+
"File '/node_modules/foo/index.d.ts' exists - use it as a name resolution result.",
20+
"Resolved under condition 'require'.",
21+
"Exiting conditional exports.",
22+
"Resolving real path for '/node_modules/foo/index.d.ts', result '/node_modules/foo/index.d.ts'.",
23+
"======== Module name 'foo' was successfully resolved to '/node_modules/foo/index.d.ts' with Package ID 'foo/index.d.ts@1.0.0'. ========",
24+
"File 'package.json' does not exist.",
25+
"File '/package.json' does not exist according to earlier cached lookups.",
26+
"======== Resolving module '@typescript/lib-es5' from '__lib_node_modules_lookup_lib.es5.d.ts__.ts'. ========",
27+
"Explicitly specified module resolution kind: 'Node10'.",
28+
"Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: TypeScript, Declaration.",
29+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
30+
"Scoped package detected, looking in 'typescript__lib-es5'",
31+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
32+
"Scoped package detected, looking in 'typescript__lib-es5'",
33+
"Loading module '@typescript/lib-es5' from 'node_modules' folder, target file types: JavaScript.",
34+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
35+
"======== Module name '@typescript/lib-es5' was not resolved. ========",
36+
"File 'package.json' does not exist according to earlier cached lookups.",
37+
"File '/package.json' does not exist according to earlier cached lookups.",
38+
"======== Resolving module '@typescript/lib-decorators' from '__lib_node_modules_lookup_lib.decorators.d.ts__.ts'. ========",
39+
"Explicitly specified module resolution kind: 'Node10'.",
40+
"Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: TypeScript, Declaration.",
41+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
42+
"Scoped package detected, looking in 'typescript__lib-decorators'",
43+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
44+
"Scoped package detected, looking in 'typescript__lib-decorators'",
45+
"Loading module '@typescript/lib-decorators' from 'node_modules' folder, target file types: JavaScript.",
46+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
47+
"======== Module name '@typescript/lib-decorators' was not resolved. ========",
48+
"File 'package.json' does not exist according to earlier cached lookups.",
49+
"File '/package.json' does not exist according to earlier cached lookups.",
50+
"======== Resolving module '@typescript/lib-decorators/legacy' from '__lib_node_modules_lookup_lib.decorators.legacy.d.ts__.ts'. ========",
51+
"Explicitly specified module resolution kind: 'Node10'.",
52+
"Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: TypeScript, Declaration.",
53+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
54+
"Scoped package detected, looking in 'typescript__lib-decorators/legacy'",
55+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
56+
"Scoped package detected, looking in 'typescript__lib-decorators/legacy'",
57+
"Loading module '@typescript/lib-decorators/legacy' from 'node_modules' folder, target file types: JavaScript.",
58+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
59+
"======== Module name '@typescript/lib-decorators/legacy' was not resolved. ========",
60+
"File 'package.json' does not exist according to earlier cached lookups.",
61+
"File '/package.json' does not exist according to earlier cached lookups.",
62+
"======== Resolving module '@typescript/lib-dom' from '__lib_node_modules_lookup_lib.dom.d.ts__.ts'. ========",
63+
"Explicitly specified module resolution kind: 'Node10'.",
64+
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: TypeScript, Declaration.",
65+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
66+
"Scoped package detected, looking in 'typescript__lib-dom'",
67+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
68+
"Scoped package detected, looking in 'typescript__lib-dom'",
69+
"Loading module '@typescript/lib-dom' from 'node_modules' folder, target file types: JavaScript.",
70+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
71+
"======== Module name '@typescript/lib-dom' was not resolved. ========",
72+
"File 'package.json' does not exist according to earlier cached lookups.",
73+
"File '/package.json' does not exist according to earlier cached lookups.",
74+
"======== Resolving module '@typescript/lib-webworker/importscripts' from '__lib_node_modules_lookup_lib.webworker.importscripts.d.ts__.ts'. ========",
75+
"Explicitly specified module resolution kind: 'Node10'.",
76+
"Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: TypeScript, Declaration.",
77+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
78+
"Scoped package detected, looking in 'typescript__lib-webworker/importscripts'",
79+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
80+
"Scoped package detected, looking in 'typescript__lib-webworker/importscripts'",
81+
"Loading module '@typescript/lib-webworker/importscripts' from 'node_modules' folder, target file types: JavaScript.",
82+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
83+
"======== Module name '@typescript/lib-webworker/importscripts' was not resolved. ========",
84+
"File 'package.json' does not exist according to earlier cached lookups.",
85+
"File '/package.json' does not exist according to earlier cached lookups.",
86+
"======== Resolving module '@typescript/lib-scripthost' from '__lib_node_modules_lookup_lib.scripthost.d.ts__.ts'. ========",
87+
"Explicitly specified module resolution kind: 'Node10'.",
88+
"Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: TypeScript, Declaration.",
89+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
90+
"Scoped package detected, looking in 'typescript__lib-scripthost'",
91+
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
92+
"Scoped package detected, looking in 'typescript__lib-scripthost'",
93+
"Loading module '@typescript/lib-scripthost' from 'node_modules' folder, target file types: JavaScript.",
94+
"Directory 'node_modules' does not exist, skipping all lookups in it.",
95+
"======== Module name '@typescript/lib-scripthost' was not resolved. ========",
96+
"File 'package.json' does not exist according to earlier cached lookups.",
97+
"File '/package.json' does not exist according to earlier cached lookups."
98+
]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// @noEmit: true
2+
// @moduleResolution: node16,nodenext
3+
// @noTypesAndSymbols: true
4+
// @traceResolution: true
5+
6+
// @filename: /node_modules/foo/package.json
7+
{
8+
"name": "foo",
9+
"version": "1.0.0",
10+
"exports": {
11+
"types": null,
12+
"require": "./index.js"
13+
}
14+
}
15+
16+
// @filename: /node_modules/foo/index.js
17+
module.exports = { a: 'a' };
18+
19+
// @filename: /node_modules/foo/index.d.ts
20+
export declare const a: 'a'
21+
22+
// @filename: /a.ts
23+
export { a } from "foo";
24+

0 commit comments

Comments
 (0)