Microsoft/TypeScript
Voir sur GitHubError when accessing properties on `globalThis` with the same name of a global variable
Open
#58 345 ouverte le 28 avr. 2024
BugDomain: Something ElseHelp Wanted
Métriques du dépôt
- Stars
- (48 455 stars)
- Métriques de merge PR
- (Merge moyen 6j 17h) (9 PRs mergées en 30 j)
Description
🔎 Search Terms
globalThis redefined error script property does not exist
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
let invalid1 = globalThis.invalid1;
let y = globalThis.invalid1;
let z = globalThis.invalid2;
🙁 Actual behavior
Property 'invalid1' does not exist on type 'typeof globalThis'.
🙂 Expected behavior
It should either complain about both invalid1 and invalid2, or neither
Additional information about the issue
It only happens in scripts and not in modules (if I add export {}, there are no reported errors).