microsoft / microsoft/TypeScript
Incorrect type declarations for a constant inside a namespace merged with an enum
Offen
Dieses Issue hat noch niemand übernommen.
Bug
Domain: Declaration Emit
Help Wanted
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔎 Search Terms
"enum", "namespace", "declaration", "d.ts", "const"
🕗 Version & Regression Information
- This changed between versions 3.1.0-dev.20180906 and 3.1.0-dev.20180907
⏯ Playground Link
💻 Code
enum Foo {
bar
}
namespace Foo {
export const baz = Foo.bar;
}
🙁 Actual behavior
Typescript generates invalid d.ts for the enum value assigned to the constant (in all versions starting 3.1.0-dev.20180907)
declare enum Foo {
bar = 0
}
declare namespace Foo {
const baz = bar; // <-- unknown `bar` identifier, `baz` type is `any`
}
In versions before 3.1.0-dev.20180906 the constant is declared as const baz: Foo;
🙂 Expected behavior
Typescript generates a valid declaration of the constant
declare enum Foo {
bar = 0
}
declare namespace Foo {
const baz = Foo.bar;
}
or
declare enum Foo {
bar = 0
}
declare namespace Foo {
const baz: Foo;
}
Additional information about the issue
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.