Skip to content

Commit 964feb1

Browse files
committed
Add a test with broken code
1 parent 7b76416 commit 964feb1

5 files changed

+279
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/index.ts(2,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
2+
/index.ts(2,32): error TS1005: '}' expected.
3+
/index.ts(2,32): error TS2695: Left side of comma operator is unused and has no side effects.
4+
/index.ts(2,55): error TS1005: ';' expected.
5+
/index.ts(2,66): error TS1128: Declaration or statement expected.
6+
/index.ts(2,68): error TS1128: Declaration or statement expected.
7+
/index.ts(2,69): error TS1128: Declaration or statement expected.
8+
/index.ts(2,70): error TS1128: Declaration or statement expected.
9+
/index.ts(2,71): error TS2304: Cannot find name 'RequireInterface'.
10+
/index.ts(3,36): error TS1005: ':' expected.
11+
/index.ts(3,70): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'.
12+
/index.ts(5,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
13+
/index.ts(5,59): error TS1005: '}' expected.
14+
/index.ts(5,59): error TS2695: Left side of comma operator is unused and has no side effects.
15+
/index.ts(5,82): error TS1005: ';' expected.
16+
/index.ts(5,93): error TS1128: Declaration or statement expected.
17+
/index.ts(5,95): error TS1128: Declaration or statement expected.
18+
/index.ts(5,96): error TS1128: Declaration or statement expected.
19+
/index.ts(5,97): error TS1128: Declaration or statement expected.
20+
/index.ts(5,98): error TS1434: Unexpected keyword or identifier.
21+
/index.ts(5,98): error TS2304: Cannot find name 'RequireInterface'.
22+
/index.ts(5,114): error TS1128: Declaration or statement expected.
23+
/index.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
24+
/index.ts(6,59): error TS1005: '}' expected.
25+
/index.ts(6,59): error TS2695: Left side of comma operator is unused and has no side effects.
26+
/index.ts(6,82): error TS1005: ';' expected.
27+
/index.ts(6,92): error TS1128: Declaration or statement expected.
28+
/index.ts(6,94): error TS1128: Declaration or statement expected.
29+
/index.ts(6,95): error TS1128: Declaration or statement expected.
30+
/index.ts(6,96): error TS1128: Declaration or statement expected.
31+
/index.ts(6,97): error TS1434: Unexpected keyword or identifier.
32+
/index.ts(6,97): error TS2304: Cannot find name 'ImportInterface'.
33+
/index.ts(6,112): error TS1128: Declaration or statement expected.
34+
35+
36+
==== /index.ts (33 errors) ====
37+
export type LocalInterface =
38+
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface
39+
~~~~~~~~~~~~~~~~~~~~~~~~~
40+
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
41+
~~~~
42+
!!! error TS1005: '}' expected.
43+
!!! related TS1007 /index.ts:2:31: The parser expected to find a '}' to match the '{' token here.
44+
!!! related TS1007 /index.ts:2:21: The parser expected to find a '}' to match the '{' token here.
45+
~~~~
46+
!!! error TS2695: Left side of comma operator is unused and has no side effects.
47+
~
48+
!!! error TS1005: ';' expected.
49+
~
50+
!!! error TS1128: Declaration or statement expected.
51+
~
52+
!!! error TS1128: Declaration or statement expected.
53+
~
54+
!!! error TS1128: Declaration or statement expected.
55+
~
56+
!!! error TS1128: Declaration or statement expected.
57+
~~~~~~~~~~~~~~~~
58+
!!! error TS2304: Cannot find name 'RequireInterface'.
59+
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface;
60+
~
61+
!!! error TS1005: ':' expected.
62+
~~~~~~~~~~~~~~~
63+
!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'.
64+
65+
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface);
66+
~~~~~~~~~~~~~~~~~~~~~~~~~
67+
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
68+
~~~~
69+
!!! error TS1005: '}' expected.
70+
!!! related TS1007 /index.ts:5:58: The parser expected to find a '}' to match the '{' token here.
71+
!!! related TS1007 /index.ts:5:48: The parser expected to find a '}' to match the '{' token here.
72+
~~~~
73+
!!! error TS2695: Left side of comma operator is unused and has no side effects.
74+
~
75+
!!! error TS1005: ';' expected.
76+
~
77+
!!! error TS1128: Declaration or statement expected.
78+
~
79+
!!! error TS1128: Declaration or statement expected.
80+
~
81+
!!! error TS1128: Declaration or statement expected.
82+
~
83+
!!! error TS1128: Declaration or statement expected.
84+
~~~~~~~~~~~~~~~~
85+
!!! error TS1434: Unexpected keyword or identifier.
86+
~~~~~~~~~~~~~~~~
87+
!!! error TS2304: Cannot find name 'RequireInterface'.
88+
~
89+
!!! error TS1128: Declaration or statement expected.
90+
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface);
91+
~~~~~~~~~~~~~~~~~~~~~~~~~
92+
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'?
93+
~~~~
94+
!!! error TS1005: '}' expected.
95+
!!! related TS1007 /index.ts:6:58: The parser expected to find a '}' to match the '{' token here.
96+
!!! related TS1007 /index.ts:6:48: The parser expected to find a '}' to match the '{' token here.
97+
~~~~
98+
!!! error TS2695: Left side of comma operator is unused and has no side effects.
99+
~
100+
!!! error TS1005: ';' expected.
101+
~
102+
!!! error TS1128: Declaration or statement expected.
103+
~
104+
!!! error TS1128: Declaration or statement expected.
105+
~
106+
!!! error TS1128: Declaration or statement expected.
107+
~
108+
!!! error TS1128: Declaration or statement expected.
109+
~~~~~~~~~~~~~~~
110+
!!! error TS1434: Unexpected keyword or identifier.
111+
~~~~~~~~~~~~~~~
112+
!!! error TS2304: Cannot find name 'ImportInterface'.
113+
~
114+
!!! error TS1128: Declaration or statement expected.
115+
116+
==== /node_modules/pkg/package.json (0 errors) ====
117+
{
118+
"name": "pkg",
119+
"version": "0.0.1",
120+
"exports": {
121+
"import": "./import.js",
122+
"require": "./require.js"
123+
}
124+
}
125+
==== /node_modules/pkg/import.d.ts (0 errors) ====
126+
export interface ImportInterface {}
127+
==== /node_modules/pkg/require.d.ts (0 errors) ====
128+
export interface RequireInterface {}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//// [tests/cases/compiler/parseAssertEntriesError.ts] ////
2+
3+
//// [package.json]
4+
{
5+
"name": "pkg",
6+
"version": "0.0.1",
7+
"exports": {
8+
"import": "./import.js",
9+
"require": "./require.js"
10+
}
11+
}
12+
//// [import.d.ts]
13+
export interface ImportInterface {}
14+
//// [require.d.ts]
15+
export interface RequireInterface {}
16+
//// [index.ts]
17+
export type LocalInterface =
18+
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface
19+
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface;
20+
21+
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface);
22+
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface);
23+
24+
25+
//// [index.js]
26+
"use strict";
27+
Object.defineProperty(exports, "__esModule", { value: true });
28+
exports.b = exports.a = void 0;
29+
1234, "resolution-mode";
30+
"require";
31+
RequireInterface
32+
& import("pkg", { assert: { 1234: , "resolution-mode": "import" } }).ImportInterface;
33+
exports.a = null;
34+
1234, "resolution-mode";
35+
"require";
36+
RequireInterface;
37+
;
38+
exports.b = null;
39+
1234, "resolution-mode";
40+
"import";
41+
ImportInterface;
42+
;
43+
44+
45+
//// [index.d.ts]
46+
export declare type LocalInterface = import("pkg", { assert: {} });
47+
export declare const a: any;
48+
export declare const b: any;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
=== /index.ts ===
2+
export type LocalInterface =
3+
>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0))
4+
5+
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface
6+
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface;
7+
>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0))
8+
>assert : Symbol(assert, Decl(index.ts, 2, 21))
9+
>1234 : Symbol(1234, Decl(index.ts, 2, 31))
10+
>"resolution-mode" : Symbol("resolution-mode", Decl(index.ts, 2, 36))
11+
12+
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface);
13+
>a : Symbol(a, Decl(index.ts, 4, 12))
14+
15+
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface);
16+
>b : Symbol(b, Decl(index.ts, 5, 12))
17+
18+
=== /node_modules/pkg/import.d.ts ===
19+
export interface ImportInterface {}
20+
>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0))
21+
22+
=== /node_modules/pkg/require.d.ts ===
23+
export interface RequireInterface {}
24+
>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0))
25+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
=== /index.ts ===
2+
export type LocalInterface =
3+
>LocalInterface : any
4+
5+
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface
6+
>1234, "resolution-mode" : "resolution-mode"
7+
>1234 : 1234
8+
>"resolution-mode" : "resolution-mode"
9+
>"require" : "require"
10+
>RequireInterface & import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface : number
11+
>RequireInterface : any
12+
13+
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface;
14+
>import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface : any
15+
>import("pkg", { assert: {1234, "resolution-mode": "import"} }) : Promise<{ default: typeof import("/node_modules/pkg/import"); }>
16+
>"pkg" : "pkg"
17+
>{ assert: {1234, "resolution-mode": "import"} } : { assert: { 1234: any; "resolution-mode": string; }; }
18+
>assert : { 1234: any; "resolution-mode": string; }
19+
>{1234, "resolution-mode": "import"} : { 1234: any; "resolution-mode": string; }
20+
>1234 : any
21+
> : any
22+
>"resolution-mode" : string
23+
>"import" : "import"
24+
>ImportInterface : any
25+
26+
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface);
27+
>a : any
28+
>(null as any as import("pkg", { assert: { : any
29+
>null as any as import("pkg", { assert: { : any
30+
>null as any : any
31+
>null : null
32+
>1234, "resolution-mode" : "resolution-mode"
33+
>1234 : 1234
34+
>"resolution-mode" : "resolution-mode"
35+
>"require" : "require"
36+
>RequireInterface : any
37+
38+
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface);
39+
>b : any
40+
>(null as any as import("pkg", { assert: { : any
41+
>null as any as import("pkg", { assert: { : any
42+
>null as any : any
43+
>null : null
44+
>1234, "resolution-mode" : "resolution-mode"
45+
>1234 : 1234
46+
>"resolution-mode" : "resolution-mode"
47+
>"import" : "import"
48+
>ImportInterface : any
49+
50+
=== /node_modules/pkg/import.d.ts ===
51+
export interface ImportInterface {}
52+
No type information for this code.=== /node_modules/pkg/require.d.ts ===
53+
export interface RequireInterface {}
54+
No type information for this code.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// @noImplicitReferences: true
2+
// @module: nodenext
3+
// @declaration: true
4+
// @outDir: out
5+
// @filename: /node_modules/pkg/package.json
6+
{
7+
"name": "pkg",
8+
"version": "0.0.1",
9+
"exports": {
10+
"import": "./import.js",
11+
"require": "./require.js"
12+
}
13+
}
14+
// @filename: /node_modules/pkg/import.d.ts
15+
export interface ImportInterface {}
16+
// @filename: /node_modules/pkg/require.d.ts
17+
export interface RequireInterface {}
18+
// @filename: /index.ts
19+
export type LocalInterface =
20+
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface
21+
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface;
22+
23+
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface);
24+
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface);

0 commit comments

Comments
 (0)