mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
Merge pull request #5390 from maybejulian/declareOnTypeAliasInDts
Allow type aliases to omit 'declare' keyword in '.d.ts' files
This commit is contained in:
commit
ed5dc5536d
@ -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 ||
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/typeAliasDeclareKeyword01.d.ts ===
|
||||
type Foo = number;
|
||||
>Foo : number
|
||||
|
||||
declare type Bar = string;
|
||||
>Bar : string
|
||||
|
||||
2
tests/cases/compiler/typeAliasDeclareKeyword01.d.ts
vendored
Normal file
2
tests/cases/compiler/typeAliasDeclareKeyword01.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
type Foo = number;
|
||||
declare type Bar = string;
|
||||
Loading…
x
Reference in New Issue
Block a user