-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Closed as not planned
Copy link
Labels
7.0 LS MigrationBugA bug in TypeScriptA bug in TypeScriptDomain: LS: Type DisplayBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion Info
Milestone
Description
TypeScript Version: 2.8.0-insiders.20180320
Search Terms: mapped type inference display typetostring
Code
Via https://stackoverflow.com/questions/50181650/type-inference-lost-inner-level-types-in-typescript
interface IAction {
type: string;
}
type Reducer<S> = (state: S, action: IAction) => S
function combineReducers<S>(reducers: { [K in keyof S]: Reducer<S[K]> }): Reducer<S> {
const dummy = {} as S;
return () => dummy;
}
const test_inner = (test: string, action: IAction) => {
return 'dummy';
}
const test = combineReducers({
test_inner
});
const test_outer = combineReducers({
test
});
// '{test: { test_inner: any } }'
type FinalType = ReturnType<typeof test_outer>;
var k: FinalType;
k.test.test_inner // 'string'Expected behavior: FinalType's hover type should be { test: { test_inner: string } }
Actual behavior: Shows as { test: { test_inner: any } }
Playground Link: Link
ikatyang, johnleider, KaelWD, inad9300 and DarkLite1
Metadata
Metadata
Assignees
Labels
7.0 LS MigrationBugA bug in TypeScriptA bug in TypeScriptDomain: LS: Type DisplayBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion Info