Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 158 additions & 117 deletions internal/parser/parser.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ index.js(5,12): error TS8010: Type annotations can only be used in TypeScript fi
index.js(8,16): error TS8004: Type parameter declarations can only be used in TypeScript files.
index.js(8,29): error TS8011: Type arguments can only be used in TypeScript files.
index.js(9,12): error TS8010: Type annotations can only be used in TypeScript files.
index.js(13,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(19,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(23,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(27,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(28,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(32,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(39,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(43,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(47,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(48,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(52,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(53,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(59,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(63,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(67,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(68,11): error TS8010: Type annotations can only be used in TypeScript files.
index.js(13,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(19,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(23,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(27,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(28,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(32,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(39,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(43,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(47,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(48,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(52,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(53,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(59,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(63,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(67,5): error TS8017: Signature declarations can only be used in TypeScript files.
index.js(68,5): error TS8017: Signature declarations can only be used in TypeScript files.


==== index.js (21 errors) ====
Expand All @@ -45,92 +45,92 @@ index.js(68,11): error TS8010: Type annotations can only be used in TypeScript f

export class O {
[idx: string]: string;
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class P extends O {}

export class Q extends O {
[idx: string]: "ok";
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class R extends O {
[idx: number]: "ok";
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class S extends O {
[idx: string]: "ok";
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: never;
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class T {
[idx: number]: string;
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class U extends T {}


export class V extends T {
[idx: string]: string;
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class W extends T {
[idx: number]: "ok";
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class X extends T {
[idx: string]: string;
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: "ok";
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class Y {
[idx: string]: {x: number};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: {x: number, y: number};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class Z extends Y {}

export class AA extends Y {
[idx: string]: {x: number, y: number};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class BB extends Y {
[idx: number]: {x: 0, y: 0};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class CC extends Y {
[idx: string]: {x: number, y: number};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: {x: 0, y: 0};
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
index.js(4,18): error TS8006: 'namespace' declarations can only be used in TypeScript files.
index.js(6,22): error TS8006: 'namespace' declarations can only be used in TypeScript files.


==== index.js (1 errors) ====
==== index.js (2 errors) ====
/// <reference types="node" />
export const Something = 2; // to show conflict that can occur
// @ts-ignore
Expand All @@ -10,6 +11,8 @@ index.js(4,18): error TS8006: 'namespace' declarations can only be used in TypeS
!!! error TS8006: 'namespace' declarations can only be used in TypeScript files.
// @ts-ignore
export namespace B {
~
!!! error TS8006: 'namespace' declarations can only be used in TypeScript files.
const Something = require("fs").Something;
const thing = new Something();
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ plainJSGrammarErrors.js(105,5): error TS18016: Private identifiers are not allow
plainJSGrammarErrors.js(106,5): error TS1042: 'export' modifier cannot be used here.
plainJSGrammarErrors.js(108,25): error TS1162: An object member cannot be declared optional.
plainJSGrammarErrors.js(109,6): error TS1162: An object member cannot be declared optional.
plainJSGrammarErrors.js(109,6): error TS8009: The '?' modifier can only be used in TypeScript files.
plainJSGrammarErrors.js(110,15): error TS1255: A definite assignment assertion '!' is not permitted in this context.
plainJSGrammarErrors.js(111,19): error TS1255: A definite assignment assertion '!' is not permitted in this context.
plainJSGrammarErrors.js(114,16): error TS1312: Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern.
Expand Down Expand Up @@ -101,7 +100,7 @@ plainJSGrammarErrors.js(204,30): message TS1450: Dynamic imports can only accept
plainJSGrammarErrors.js(205,36): error TS1325: Argument of dynamic import cannot be spread element.


==== plainJSGrammarErrors.js (101 errors) ====
==== plainJSGrammarErrors.js (100 errors) ====
class C {
// #private mistakes
q = #unbound
Expand Down Expand Up @@ -347,8 +346,6 @@ plainJSGrammarErrors.js(205,36): error TS1325: Argument of dynamic import cannot
m?() { return 12 },
~
!!! error TS1162: An object member cannot be declared optional.
~
!!! error TS8009: The '?' modifier can only be used in TypeScript files.
definitely!,
~
!!! error TS1255: A definite assignment assertion '!' is not permitted in this context.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
--- old.jsDeclarationsClassesErr.errors.txt
+++ new.jsDeclarationsClassesErr.errors.txt
@@= skipped -2, +2 lines =@@
index.js(8,16): error TS8004: Type parameter declarations can only be used in TypeScript files.
index.js(8,29): error TS8011: Type arguments can only be used in TypeScript files.
index.js(9,12): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(13,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(19,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(23,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(27,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(28,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(32,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(39,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(43,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(47,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(48,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(52,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(53,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(59,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(63,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(67,11): error TS8010: Type annotations can only be used in TypeScript files.
-index.js(68,11): error TS8010: Type annotations can only be used in TypeScript files.
+index.js(13,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(19,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(23,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(27,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(28,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(32,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(39,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(43,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(47,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(48,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(52,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(53,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(59,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(63,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(67,5): error TS8017: Signature declarations can only be used in TypeScript files.
+index.js(68,5): error TS8017: Signature declarations can only be used in TypeScript files.


==== index.js (21 errors) ====
@@= skipped -42, +42 lines =@@

export class O {
[idx: string]: string;
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class P extends O {}

export class Q extends O {
[idx: string]: "ok";
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class R extends O {
[idx: number]: "ok";
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class S extends O {
[idx: string]: "ok";
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: never;
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class T {
[idx: number]: string;
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class U extends T {}
@@= skipped -38, +38 lines =@@

export class V extends T {
[idx: string]: string;
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class W extends T {
[idx: number]: "ok";
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class X extends T {
[idx: string]: string;
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: "ok";
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class Y {
[idx: string]: {x: number};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: {x: number, y: number};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class Z extends Y {}

export class AA extends Y {
[idx: string]: {x: number, y: number};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class BB extends Y {
[idx: number]: {x: 0, y: 0};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

export class CC extends Y {
[idx: string]: {x: number, y: number};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
[idx: number]: {x: 0, y: 0};
- ~~~~~~
-!!! error TS8010: Type annotations can only be used in TypeScript files.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

Loading
Loading