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
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export class Parser extends DiagnosticEmitter {
}
// ... | type
while (tn.skip(Token.Bar)) {
let nextType = this.parseType(tn, false, true);
let nextType = this.parseType(tn, true, false);
if (!nextType) return null;
let typeIsNull = type.kind == NodeKind.NamedType && (<NamedTypeNode>type).isNull;
let nextTypeIsNull = nextType.kind == NodeKind.NamedType && (<NamedTypeNode>nextType).isNull;
Expand Down
9 changes: 9 additions & 0 deletions tests/parser/union.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function foo(a: aaa | bbb | ccc): i32 {
return 1;
}

export function bar(a: i32 | u32 | f32): i32 {
return 1;
}

export let a: i32 | u32 | f32 | null = 1;
4 changes: 4 additions & 0 deletions tests/parser/union.ts.fixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export let a = 1;
// ERROR 100: "Not implemented: union types" in union.ts(1,36+3)
// ERROR 100: "Not implemented: union types" in union.ts(5,36+3)
// ERROR 100: "Not implemented: union types" in union.ts(9,27+10)
Loading