Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
240 changes: 129 additions & 111 deletions internal/parser/parser.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ a.js(2,3): error TS8017: Signature declarations can only be used in TypeScript f
==== a.js (1 errors) ====
class A {
constructor();
~~~~~~~~~~~
~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
a.js(1,10): error TS8017: Signature declarations can only be used in TypeScript files.
a.js(1,1): error TS8017: Signature declarations can only be used in TypeScript files.


==== a.js (1 errors) ====
function foo();
~~~
~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ a.js(2,3): error TS8017: Signature declarations can only be used in TypeScript f
==== a.js (1 errors) ====
class A {
foo();
~~~
~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

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 @@ -13,7 +13,7 @@ plainJSGrammarErrors.js(26,11): error TS1030: 'async' modifier already seen.
plainJSGrammarErrors.js(28,11): error TS1029: 'static' modifier must precede 'async' modifier.
plainJSGrammarErrors.js(29,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
plainJSGrammarErrors.js(30,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
plainJSGrammarErrors.js(34,9): error TS8017: Signature declarations can only be used in TypeScript files.
plainJSGrammarErrors.js(34,5): error TS8017: Signature declarations can only be used in TypeScript files.
plainJSGrammarErrors.js(34,22): error TS1005: '{' expected.
plainJSGrammarErrors.js(35,9): error TS1054: A 'get' accessor cannot have parameters.
plainJSGrammarErrors.js(36,9): error TS1049: A 'set' accessor must have exactly one parameter.
Expand Down Expand Up @@ -166,7 +166,7 @@ plainJSGrammarErrors.js(205,36): error TS1325: Argument of dynamic import cannot

// accessor mistakes
get incorporeal();
~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
~
!!! error TS1005: '{' expected.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- old.jsFileCompilationConstructorOverloadSyntax.errors.txt
+++ new.jsFileCompilationConstructorOverloadSyntax.errors.txt
@@= skipped -3, +3 lines =@@
==== a.js (1 errors) ====
class A {
constructor();
- ~~~~~~~~~~~
+ ~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- old.jsFileCompilationFunctionOverloadSyntax.errors.txt
+++ new.jsFileCompilationFunctionOverloadSyntax.errors.txt
@@= skipped -0, +0 lines =@@
-a.js(1,10): error TS8017: Signature declarations can only be used in TypeScript files.
+a.js(1,1): error TS8017: Signature declarations can only be used in TypeScript files.


==== a.js (1 errors) ====
function foo();
- ~~~
+ ~~~~~~~~~~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- old.jsFileCompilationMethodOverloadSyntax.errors.txt
+++ new.jsFileCompilationMethodOverloadSyntax.errors.txt
@@= skipped -3, +3 lines =@@
==== a.js (1 errors) ====
class A {
foo();
- ~~~
+ ~~~~~~
!!! error TS8017: Signature declarations can only be used in TypeScript files.
}

Loading
Loading