You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeFoo<T,FextendskeyofT>={pf: {[PinF]?: T[P]},pt: {[PinT]?: T[P]},// note: should be in keyof T};typeO={x: number,y: boolean};leto: O={x: 5,y: false};letf: Foo<O,'x'>={pf: {x: 7},pt: {x: 7,y: false},};
Expected behavior:
Compiling only the first type declaration produces the following expected error:
$ node node_modules/typescript/bin/tsc test.ts
test.ts(4,16): error TS2322: Type '{}' is not assignable to type 'string'.
test.ts(4,21): error TS2536: Type 'P' cannot be used to index type 'T'.
Actual behavior:
Compiling the whole example with a clean nightly install without tsconfig produces:
$ node node_modules/typescript/bin/tsc test.ts
C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:49834
throw e;
^
TypeError: Cannot read property 'flags' of undefined
at getModifiersTypeFromMappedType (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:23125:60)
at resolveMappedTypeMembers (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:23068:49)
at resolveStructuredTypeMembers (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:23153:25)
at getPropertyOfType (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:23307:32)
at C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:28345:47
at applyToContextualType (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:28321:24)
at getTypeOfPropertyOfContextualType (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:28344:20)
at getContextualTypeForObjectLiteralElement (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:28368:40)
at getContextualType (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:28442:28)
at checkExpressionForMutableLocation (C:\Users\...\Documents\TCM\git\tmp\node_modules\typescript\lib\tsc.js:31213:69)
TypeScript Version: nightly (2.2.0-dev.20161219)
Code
Expected behavior:
Compiling only the first type declaration produces the following expected error:
Actual behavior:
Compiling the whole example with a clean nightly install without
tsconfigproduces: