`satisfies` does not work on a variable called `type`
#58,248 opened on 2024幎4æ19æ¥
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
satisfies, type, ts1005
ð Version & Regression Information
This happens from 3.3.3333 to nightly.
satisfies was introduced in 4.9.
⯠Playground Link
https://www.typescriptlang.org/play?#code/MYewdgzgLgBFCeAHApjAvDA5AD0wKDwRRggEMoBLCAMwuQhKgCcKwBzPIA
ð» Code
const type = 'x'
type satisfies string // '=' expected.(1005)
ð Actual behavior
Gives an '=' expected.(1005) error.
ð Expected behavior
For it to work like with any other variable of any other name, specially since it's a common variable name.
Additional information about the issue
This also happens with other TypeScript keywords like interface.
If I wrap type in parenthesis it works, is this expected behaviour? The Deno formatter removes it (prettier handles it correctly), should I report this to them.