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
1 change: 1 addition & 0 deletions internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2887,6 +2887,7 @@ func (p *Parser) parseImportType() *ast.Node {
}
p.parseExpected(ast.KindColonToken)
attributes = p.parseImportAttributes(currentToken, true /*skipKeyword*/)
p.parseOptional(ast.KindCommaToken)
if !p.parseExpected(ast.KindCloseBraceToken) {
if len(p.diagnostics) != 0 {
lastDiagnostic := p.diagnostics[len(p.diagnostics)-1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
b.ts(7,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
b.ts(10,4): error TS1005: '}' expected.
b.ts(11,1): error TS1128: Declaration or statement expected.
b.ts(11,2): error TS1128: Declaration or statement expected.
b.ts(13,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
b.ts(19,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
b.ts(22,4): error TS1005: '}' expected.
b.ts(22,5): error TS1128: Declaration or statement expected.
b.ts(22,5): error TS1005: '}' expected.
b.ts(23,1): error TS1128: Declaration or statement expected.
b.ts(23,2): error TS1128: Declaration or statement expected.
b.ts(25,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
Expand All @@ -15,7 +11,7 @@ b.ts(27,18): error TS1478: Identifier or string literal expected.
==== a.json (0 errors) ====
{ "key": "value" }

==== b.ts (12 errors) ====
==== b.ts (8 errors) ====
declare global {
interface ImportAttributes {
type: "json"
Expand All @@ -28,14 +24,7 @@ b.ts(27,18): error TS1478: Identifier or string literal expected.
with: {
type: "json"
},
~
!!! error TS1005: '}' expected.
!!! related TS1007 b.ts:7:47: The parser expected to find a '}' to match the '{' token here.
});
~
!!! error TS1128: Declaration or statement expected.
~
!!! error TS1128: Declaration or statement expected.

export type Test2 = typeof import("./a.json", {
~~~~~~~~~~
Expand All @@ -51,11 +40,9 @@ b.ts(27,18): error TS1478: Identifier or string literal expected.
with: {
type: "json"
},,
~
~
!!! error TS1005: '}' expected.
!!! related TS1007 b.ts:19:47: The parser expected to find a '}' to match the '{' token here.
~
!!! error TS1128: Declaration or statement expected.
});
~
!!! error TS1128: Declaration or statement expected.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
--- old.importAttributes10.errors.txt
+++ new.importAttributes10.errors.txt
@@= skipped -0, +0 lines =@@
-b.ts(22,5): error TS1005: '}' expected.
+b.ts(7,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
+b.ts(10,4): error TS1005: '}' expected.
+b.ts(11,1): error TS1128: Declaration or statement expected.
+b.ts(11,2): error TS1128: Declaration or statement expected.
+b.ts(13,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
+b.ts(19,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
+b.ts(22,4): error TS1005: '}' expected.
+b.ts(22,5): error TS1128: Declaration or statement expected.
b.ts(22,5): error TS1005: '}' expected.
b.ts(23,1): error TS1128: Declaration or statement expected.
b.ts(23,2): error TS1128: Declaration or statement expected.
+b.ts(25,35): error TS2732: Cannot find module './a.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.
Expand All @@ -20,11 +15,11 @@
{ "key": "value" }

-==== b.ts (4 errors) ====
+==== b.ts (12 errors) ====
+==== b.ts (8 errors) ====
declare global {
interface ImportAttributes {
type: "json"
@@= skipped -14, +22 lines =@@
@@= skipped -14, +18 lines =@@
}

export type Test1 = typeof import("./a.json", {
Expand All @@ -33,14 +28,7 @@
with: {
type: "json"
},
+ ~
+!!! error TS1005: '}' expected.
+!!! related TS1007 b.ts:7:47: The parser expected to find a '}' to match the '{' token here.
});
+ ~
+!!! error TS1128: Declaration or statement expected.
+ ~
+!!! error TS1128: Declaration or statement expected.

export type Test2 = typeof import("./a.json", {
+ ~~~~~~~~~~
Expand All @@ -56,16 +44,7 @@
with: {
type: "json"
},,
- ~
+ ~
!!! error TS1005: '}' expected.
!!! related TS1007 b.ts:19:47: The parser expected to find a '}' to match the '{' token here.
+ ~
+!!! error TS1128: Declaration or statement expected.
});
~
!!! error TS1128: Declaration or statement expected.
@@= skipped -25, +40 lines =@@
@@= skipped -25, +31 lines =@@
!!! error TS1128: Declaration or statement expected.

export type Test4 = typeof import("./a.json", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ export type Test4 = typeof import("./a.json", {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
;

This file was deleted.