Closed
Description
TypeScript Version: Nightly
Search Terms:
keyof dynamic keys, keyof extended dynamic interface, keyof generic interface
Expected behavior:
bKey
should have "a"
as type.
Actual behavior:
bKey
has string | number
as type.
Related Issues:
14359
Code
interface A {
[key: string]: number;
}
interface B extends A {
a: number;
}
const bKey: keyof B = 'foo';
Output
"use strict";
const bKey = 'foo';
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useDefineForClassFields": false,
"alwaysStrict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"downlevelIteration": false,
"noEmitHelpers": false,
"noLib": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"esModuleInterop": true,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": false,
"checkJs": false,
"allowJs": false,
"declaration": true,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"target": "ES2017",
"module": "ESNext"
}
}
Playground Link: Provided
Metadata
Metadata
Assignees
Labels
No labels