-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve parsingContextErrors TODO (#50011)
* Add a test with broken code * Resolve TODO
- Loading branch information
1 parent
bcd22b4
commit 3afe2d6
Showing
7 changed files
with
280 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
tests/baselines/reference/parseAssertEntriesError.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/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')'? | ||
/index.ts(2,32): error TS1478: Identifier or string literal expected. | ||
/index.ts(2,32): error TS2695: Left side of comma operator is unused and has no side effects. | ||
/index.ts(2,55): error TS1005: ';' expected. | ||
/index.ts(2,66): error TS1128: Declaration or statement expected. | ||
/index.ts(2,68): error TS1128: Declaration or statement expected. | ||
/index.ts(2,69): error TS1128: Declaration or statement expected. | ||
/index.ts(2,70): error TS1128: Declaration or statement expected. | ||
/index.ts(2,71): error TS2304: Cannot find name 'RequireInterface'. | ||
/index.ts(3,36): error TS1005: ':' expected. | ||
/index.ts(3,70): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. | ||
/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')'? | ||
/index.ts(5,59): error TS1478: Identifier or string literal expected. | ||
/index.ts(5,59): error TS2695: Left side of comma operator is unused and has no side effects. | ||
/index.ts(5,82): error TS1005: ';' expected. | ||
/index.ts(5,93): error TS1128: Declaration or statement expected. | ||
/index.ts(5,95): error TS1128: Declaration or statement expected. | ||
/index.ts(5,96): error TS1128: Declaration or statement expected. | ||
/index.ts(5,97): error TS1128: Declaration or statement expected. | ||
/index.ts(5,98): error TS1434: Unexpected keyword or identifier. | ||
/index.ts(5,98): error TS2304: Cannot find name 'RequireInterface'. | ||
/index.ts(5,114): error TS1128: Declaration or statement expected. | ||
/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')'? | ||
/index.ts(6,59): error TS1478: Identifier or string literal expected. | ||
/index.ts(6,59): error TS2695: Left side of comma operator is unused and has no side effects. | ||
/index.ts(6,82): error TS1005: ';' expected. | ||
/index.ts(6,92): error TS1128: Declaration or statement expected. | ||
/index.ts(6,94): error TS1128: Declaration or statement expected. | ||
/index.ts(6,95): error TS1128: Declaration or statement expected. | ||
/index.ts(6,96): error TS1128: Declaration or statement expected. | ||
/index.ts(6,97): error TS1434: Unexpected keyword or identifier. | ||
/index.ts(6,97): error TS2304: Cannot find name 'ImportInterface'. | ||
/index.ts(6,112): error TS1128: Declaration or statement expected. | ||
|
||
|
||
==== /index.ts (33 errors) ==== | ||
export type LocalInterface = | ||
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? | ||
~~~~ | ||
!!! error TS1478: Identifier or string literal expected. | ||
~~~~ | ||
!!! error TS2695: Left side of comma operator is unused and has no side effects. | ||
~ | ||
!!! error TS1005: ';' expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~~~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'RequireInterface'. | ||
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface; | ||
~ | ||
!!! error TS1005: ':' expected. | ||
~~~~~~~~~~~~~~~ | ||
!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. | ||
|
||
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? | ||
~~~~ | ||
!!! error TS1478: Identifier or string literal expected. | ||
~~~~ | ||
!!! error TS2695: Left side of comma operator is unused and has no side effects. | ||
~ | ||
!!! error TS1005: ';' expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~~~~~~~~~~~~~~~~ | ||
!!! error TS1434: Unexpected keyword or identifier. | ||
~~~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'RequireInterface'. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? | ||
~~~~ | ||
!!! error TS1478: Identifier or string literal expected. | ||
~~~~ | ||
!!! error TS2695: Left side of comma operator is unused and has no side effects. | ||
~ | ||
!!! error TS1005: ';' expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
~~~~~~~~~~~~~~~ | ||
!!! error TS1434: Unexpected keyword or identifier. | ||
~~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'ImportInterface'. | ||
~ | ||
!!! error TS1128: Declaration or statement expected. | ||
|
||
==== /node_modules/pkg/package.json (0 errors) ==== | ||
{ | ||
"name": "pkg", | ||
"version": "0.0.1", | ||
"exports": { | ||
"import": "./import.js", | ||
"require": "./require.js" | ||
} | ||
} | ||
==== /node_modules/pkg/import.d.ts (0 errors) ==== | ||
export interface ImportInterface {} | ||
==== /node_modules/pkg/require.d.ts (0 errors) ==== | ||
export interface RequireInterface {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//// [tests/cases/compiler/parseAssertEntriesError.ts] //// | ||
|
||
//// [package.json] | ||
{ | ||
"name": "pkg", | ||
"version": "0.0.1", | ||
"exports": { | ||
"import": "./import.js", | ||
"require": "./require.js" | ||
} | ||
} | ||
//// [import.d.ts] | ||
export interface ImportInterface {} | ||
//// [require.d.ts] | ||
export interface RequireInterface {} | ||
//// [index.ts] | ||
export type LocalInterface = | ||
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface | ||
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface; | ||
|
||
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); | ||
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); | ||
|
||
|
||
//// [index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.b = exports.a = void 0; | ||
1234, "resolution-mode"; | ||
"require"; | ||
RequireInterface | ||
& import("pkg", { assert: { 1234: , "resolution-mode": "import" } }).ImportInterface; | ||
exports.a = null; | ||
1234, "resolution-mode"; | ||
"require"; | ||
RequireInterface; | ||
; | ||
exports.b = null; | ||
1234, "resolution-mode"; | ||
"import"; | ||
ImportInterface; | ||
; | ||
|
||
|
||
//// [index.d.ts] | ||
export declare type LocalInterface = import("pkg", { assert: {} }); | ||
export declare const a: any; | ||
export declare const b: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=== /index.ts === | ||
export type LocalInterface = | ||
>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) | ||
|
||
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface | ||
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface; | ||
>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) | ||
>assert : Symbol(assert, Decl(index.ts, 2, 21)) | ||
>1234 : Symbol(1234, Decl(index.ts, 2, 31)) | ||
>"resolution-mode" : Symbol("resolution-mode", Decl(index.ts, 2, 36)) | ||
|
||
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); | ||
>a : Symbol(a, Decl(index.ts, 4, 12)) | ||
|
||
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); | ||
>b : Symbol(b, Decl(index.ts, 5, 12)) | ||
|
||
=== /node_modules/pkg/import.d.ts === | ||
export interface ImportInterface {} | ||
>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) | ||
|
||
=== /node_modules/pkg/require.d.ts === | ||
export interface RequireInterface {} | ||
>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
=== /index.ts === | ||
export type LocalInterface = | ||
>LocalInterface : any | ||
|
||
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface | ||
>1234, "resolution-mode" : "resolution-mode" | ||
>1234 : 1234 | ||
>"resolution-mode" : "resolution-mode" | ||
>"require" : "require" | ||
>RequireInterface & import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface : number | ||
>RequireInterface : any | ||
|
||
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface; | ||
>import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface : any | ||
>import("pkg", { assert: {1234, "resolution-mode": "import"} }) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> | ||
>"pkg" : "pkg" | ||
>{ assert: {1234, "resolution-mode": "import"} } : { assert: { 1234: any; "resolution-mode": string; }; } | ||
>assert : { 1234: any; "resolution-mode": string; } | ||
>{1234, "resolution-mode": "import"} : { 1234: any; "resolution-mode": string; } | ||
>1234 : any | ||
> : any | ||
>"resolution-mode" : string | ||
>"import" : "import" | ||
>ImportInterface : any | ||
|
||
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); | ||
>a : any | ||
>(null as any as import("pkg", { assert: { : any | ||
>null as any as import("pkg", { assert: { : any | ||
>null as any : any | ||
>null : null | ||
>1234, "resolution-mode" : "resolution-mode" | ||
>1234 : 1234 | ||
>"resolution-mode" : "resolution-mode" | ||
>"require" : "require" | ||
>RequireInterface : any | ||
|
||
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); | ||
>b : any | ||
>(null as any as import("pkg", { assert: { : any | ||
>null as any as import("pkg", { assert: { : any | ||
>null as any : any | ||
>null : null | ||
>1234, "resolution-mode" : "resolution-mode" | ||
>1234 : 1234 | ||
>"resolution-mode" : "resolution-mode" | ||
>"import" : "import" | ||
>ImportInterface : any | ||
|
||
=== /node_modules/pkg/import.d.ts === | ||
export interface ImportInterface {} | ||
No type information for this code.=== /node_modules/pkg/require.d.ts === | ||
export interface RequireInterface {} | ||
No type information for this code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @noImplicitReferences: true | ||
// @module: nodenext | ||
// @declaration: true | ||
// @outDir: out | ||
// @filename: /node_modules/pkg/package.json | ||
{ | ||
"name": "pkg", | ||
"version": "0.0.1", | ||
"exports": { | ||
"import": "./import.js", | ||
"require": "./require.js" | ||
} | ||
} | ||
// @filename: /node_modules/pkg/import.d.ts | ||
export interface ImportInterface {} | ||
// @filename: /node_modules/pkg/require.d.ts | ||
export interface RequireInterface {} | ||
// @filename: /index.ts | ||
export type LocalInterface = | ||
& import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface | ||
& import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface; | ||
|
||
export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); | ||
export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); |