microsoft / microsoft/TypeScript
No error when exporting from global augmentations
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
If you export a binding from the global scope, you're supposed to get an error unless you create a local binding and export it with whatever name you want.
```ts
export { Math };
// ~~~~
// Cannot export 'Math'. Only local declarations can be exported from a module.
```
However, we have a hole and allow exports that originate from a global augmentation. The following file is permitted with no error:
```ts
declare global {
var XYZ: number;
}
export { XYZ };
```
[Playground Link](https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEBzCB7ARlC8DeAoeB8AbrPABoCaAWgFzwB2ArgLZogwDcuAvrriAA8ADihgAXHOWrxuHIA)
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.