TypeScript Version: 3.8.3
Search Terms:
no-op mapped type, assignable
Code
typeFoo<IdentifierTextendsRecord<PropertyKey,PropertyKey>>=IdentifierT;typeBar<IdentifierTextendsRecord<PropertyKey,PropertyKey>,T>={[kinkeyofT] : Foo<IdentifierT&{k : k}>};typeMerge2<T>={[kinkeyofT] : T[k]}typeBar2<IdentifierTextendsRecord<PropertyKey,PropertyKey>,T>={[kinkeyofT]: Foo<Merge2<IdentifierT&{k: k}>>// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// Works in 3.5.1// Works in 3.6.3// Works in 3.7.5// Fails in 3.8.3};typeIdentity<T>=T;typeMerge3<T>=Identity<{[kinkeyofT] : T[k]}>typeBar3<IdentifierTextendsRecord<PropertyKey,PropertyKey>,T>={[kinkeyofT]: Foo<Merge3<IdentifierT&{k: k}>>// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// Works in 3.5.1// Works in 3.6.3// Works in 3.7.5// Fails in 3.8.3};Expected behavior:
Passes type checking
Actual behavior:
Fails in TS 3.8.3
Playground Link:
Playground
Related Issues:
Not that I could find
Well, it isn't exactly a "no-op" mapped type.
It will strip call and constructor signatures, but "no-op mapped type" was the best name I had for it.
TypeScript Version: 3.8.3
Search Terms:
no-op mapped type, assignable
Code
Expected behavior:
Passes type checking
Actual behavior:
Fails in TS 3.8.3
Playground Link:
Playground
Related Issues:
Not that I could find
Well, it isn't exactly a "no-op" mapped type.
It will strip call and constructor signatures, but "no-op mapped type" was the best name I had for it.