microsoft / microsoft/TypeScript
namespace containing only 'const enum' can be used as value -> causing runtime error
@weswigham ci sta già lavorando.
Dal 8/12/2018.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: 3.2.0-dev.20181110
Search Terms: namespace const enum
Code
namespace foo {
export const enum Foo {}
}
console.log(foo);
Expected behavior:
Error when using foo as a value. It's already an error to use a namespace that contains only types (and is therefore not emitted) as value.
The Symbol of the ModuleDeclaration actually contains constEnumOnlyModule: true, it just needs to be checked.
Actual behavior:
Doesn't emit the namespace in transpiled output, but it's still referenced by console.log(foo);
Playground Link: https://agentcooper.github.io/typescript-play/#code/HYQwtgpgzgDiDGEAEAzA9mpBvAUE-SEAHjGgE4AuS8awUVEwArmEgGIbYC+OPNdaADYQAdILQBzABTo0ASgDcQA
Related Issues:
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.