diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fd6b1d81818..f64c25217bd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15979,11 +15979,14 @@ namespace ts { // DeclarationElement: // ExportAssignment // export_opt InterfaceDeclaration + // export_opt TypeAliasDeclaration // export_opt ImportDeclaration // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // + // TODO: The spec needs to be amended to reflect this grammar. if (node.kind === SyntaxKind.InterfaceDeclaration || + node.kind === SyntaxKind.TypeAliasDeclaration || node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration || diff --git a/tests/baselines/reference/typeAliasDeclareKeyword01.d.symbols b/tests/baselines/reference/typeAliasDeclareKeyword01.d.symbols new file mode 100644 index 00000000000..86c1ae8f40c --- /dev/null +++ b/tests/baselines/reference/typeAliasDeclareKeyword01.d.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/typeAliasDeclareKeyword01.d.ts === +type Foo = number; +>Foo : Symbol(Foo, Decl(typeAliasDeclareKeyword01.d.ts, 0, 0)) + +declare type Bar = string; +>Bar : Symbol(Bar, Decl(typeAliasDeclareKeyword01.d.ts, 0, 18)) + diff --git a/tests/baselines/reference/typeAliasDeclareKeyword01.d.types b/tests/baselines/reference/typeAliasDeclareKeyword01.d.types new file mode 100644 index 00000000000..588fdd9012c --- /dev/null +++ b/tests/baselines/reference/typeAliasDeclareKeyword01.d.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/typeAliasDeclareKeyword01.d.ts === +type Foo = number; +>Foo : number + +declare type Bar = string; +>Bar : string + diff --git a/tests/cases/compiler/typeAliasDeclareKeyword01.d.ts b/tests/cases/compiler/typeAliasDeclareKeyword01.d.ts new file mode 100644 index 00000000000..cf2a5061937 --- /dev/null +++ b/tests/cases/compiler/typeAliasDeclareKeyword01.d.ts @@ -0,0 +1,2 @@ +type Foo = number; +declare type Bar = string; \ No newline at end of file