Parse untyped object type members separated by ','
Previously if the first member was untyped and the separator was ',', then parsing would fail.
This commit is contained in:
parent
b0f7f2f99c
commit
0a985ee287
|
@ -2339,6 +2339,7 @@ namespace ts {
|
|||
token() === SyntaxKind.LessThanToken ||
|
||||
token() === SyntaxKind.QuestionToken ||
|
||||
token() === SyntaxKind.ColonToken ||
|
||||
token() === SyntaxKind.CommaToken ||
|
||||
canParseSemicolon();
|
||||
}
|
||||
return false;
|
||||
|
|
10
tests/baselines/reference/parseObjectLiteralsWithoutTypes.js
Normal file
10
tests/baselines/reference/parseObjectLiteralsWithoutTypes.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [parseObjectLiteralsWithoutTypes.ts]
|
||||
let x: { foo, bar }
|
||||
let y: { foo: number, bar }
|
||||
let z: { foo, bar: number }
|
||||
|
||||
|
||||
//// [parseObjectLiteralsWithoutTypes.js]
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts ===
|
||||
let x: { foo, bar }
|
||||
>x : Symbol(x, Decl(parseObjectLiteralsWithoutTypes.ts, 0, 3))
|
||||
>foo : Symbol(foo, Decl(parseObjectLiteralsWithoutTypes.ts, 0, 8))
|
||||
>bar : Symbol(bar, Decl(parseObjectLiteralsWithoutTypes.ts, 0, 13))
|
||||
|
||||
let y: { foo: number, bar }
|
||||
>y : Symbol(y, Decl(parseObjectLiteralsWithoutTypes.ts, 1, 3))
|
||||
>foo : Symbol(foo, Decl(parseObjectLiteralsWithoutTypes.ts, 1, 8))
|
||||
>bar : Symbol(bar, Decl(parseObjectLiteralsWithoutTypes.ts, 1, 21))
|
||||
|
||||
let z: { foo, bar: number }
|
||||
>z : Symbol(z, Decl(parseObjectLiteralsWithoutTypes.ts, 2, 3))
|
||||
>foo : Symbol(foo, Decl(parseObjectLiteralsWithoutTypes.ts, 2, 8))
|
||||
>bar : Symbol(bar, Decl(parseObjectLiteralsWithoutTypes.ts, 2, 13))
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts ===
|
||||
let x: { foo, bar }
|
||||
>x : { foo: any; bar: any; }
|
||||
>foo : any
|
||||
>bar : any
|
||||
|
||||
let y: { foo: number, bar }
|
||||
>y : { foo: number; bar: any; }
|
||||
>foo : number
|
||||
>bar : any
|
||||
|
||||
let z: { foo, bar: number }
|
||||
>z : { foo: any; bar: number; }
|
||||
>foo : any
|
||||
>bar : number
|
||||
|
3
tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts
Normal file
3
tests/cases/compiler/parseObjectLiteralsWithoutTypes.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
let x: { foo, bar }
|
||||
let y: { foo: number, bar }
|
||||
let z: { foo, bar: number }
|
Loading…
Reference in a new issue