Skip to content

Commit 6296481

Browse files
committed
Support for type aliases inside ambient module declarations. microsoft/TypeScript#3004
1 parent 4ac2bbf commit 6296481

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@ export function testTypeAlias2(test: nodeunit.Test): void {
302302
roundTrip(test, `type strings = string|string[];`);
303303
}
304304

305+
export function testTypeAliasInModule(test: nodeunit.Test): void {
306+
roundTrip(test, `declare module "foo" {
307+
type strings = string|string[];
308+
}`);
309+
}
310+
305311
export function testImportDeclaration(test: nodeunit.Test): void {
306312
roundTrip(test, `import foo = bar;`);
307313
}

typescript_definition.pegjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,15 @@ ambient_module_element
778778
/ EXPORT __ result:ambient_enum_declaration { result.export = true; return result; }
779779
/ EXPORT __ result:ambient_module_declaration { result.export = true; return result; }
780780
/ EXPORT __ result:import_declaration { result.export = true; return result; }
781+
/ EXPORT __ result:type_alias_declaration { result.export = true; return result; }
781782
/ ambient_variable_declaration
782783
/ ambient_function_declaration
783784
/ ambient_class_declaration
784785
/ interface_declaration
785786
/ ambient_enum_declaration
786787
/ ambient_module_declaration
787788
/ import_declaration
789+
/ type_alias_declaration
788790
/ __
789791

790792
/* Class */

0 commit comments

Comments
 (0)