Closed
Description
Bug Report
π Search Terms
- extends keyof, missing key
π Version & Regression Information
I saw this in 4.3.0 beta, it seems to exists in the nightly. It was working on 4.2.x
β― Playground Link
export interface GlobalOptions {
// cannot be added or it wouldn't be able to be extended
// suffix: string
}
// this is added by a user to extend a global customization
export interface GlobalOptions {
// suffix: 'New'
}
export type WithSuffix<S extends string> = `${S}${'suffix' extends keyof GlobalOptions ? GlobalOptions['suffix'] : 'Suffix'}`
declare let a: WithSuffix<'hi'>
Output
export {};
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2017",
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node"
}
}
Playground Link: Provided
### π Actual behavior
Error with `suffix cannot be used to index`
### π Expected behavior
No Error