Microsoft/TypeScript
GitHub ã§èŠãType printing does not detect that a name is shadowed in the current scope
Open
#58,456 opened on 2024幎5æ7æ¥
BugDomain: Declaration EmitHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
global shadowed declarations
ð Version & Regression Information
- This is the behavior in every version I tried, and I reviewed
⯠Playground Link
ð» Code
// @strict: true
// @declaration: true
// @target: es2020
// @filename: a.ts
export const o = {[Symbol.iterator]: 1}
// @filename: b.ts
import { o } from "./a";
export class Symbol { }
export const g = o;
ð Actual behavior
The typeof of g is { [Symbol.iterator]: number; }. This leads to an incorrect declaration since Symbol is shadowed in the current scope
ð Expected behavior
The typeof of g is { [globalThis.Symbol.iterator]: number; }.
Additional information about the issue
No response