-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
We got a report that as const stopped being special case syntax from NordicSemiconductor/cloud-e2e-bdd-test-runner-js#188
🔎 Search Terms
as const 4.3 Cannot find name 'const'
🕗 Version & Regression Information
- This changed between versions 4.2 and 4.3
⏯ Playground Link
type Store = { a: 123 }
export type Cleaner = <W extends Store>(runner: FeatureRunner<W>) => Promise<any>
export class FeatureRunner<W extends Store> {
private readonly cleaners: Cleaner[] = []
async runFeature(): Promise<any> {
const objectWhichShouldBeConst = {
flags: {},
settings: {},
} as const
// ERR: Cannot find name 'const'.
return objectWhichShouldBeConst
}
async run(): Promise<any> {
const result = {}
// Removing this line gets rid of the error above
this.cleaners.forEach(c => c(this))
return result
}
}🙁 Actual behavior
Compiler error from bad lookup for const
🙂 Expected behavior
No error
MartinJohns
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue