We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? # to your account
Mapper class explicite inference for primitive
PLAYGROUND
if need, here is a very simple and epurate playground without all the tests. SMALL_PLAYGROUND
I have added some additional tests in order to gather more information and understand what is happening. Bugs and fixes are the two adresse to verify.
declare function rollable( n:number ):number export abstract class Abstract { [key: string]: number #Abstract!: never; } class Test { bug = new class { property1 = 1; property2 = rollable( 2 ); }(); fix = new class { property1:number = 1; property2 = rollable( 2 ); }(); moreBug1 = new class { property1 = 1 as const; property2 = rollable( 2 ); }(); moreBug2 = new class extends Abstract { property1 = 1 as const; property2 = rollable( 2 ); }(); } type Mapper<T> ={ [k in keyof T]: [k, T[k]]; } type Mapper2<T> ={ [k in keyof T as string extends k ? never : k]: [k, T[k]]; } type mapper_bug = Mapper<Test['bug']>; // work in version: 5.6.3 type mapper_fix = Mapper<Test['fix']>; // expected : property1: ["property1", number]; // ^? type mapper_moreTest1 = Mapper<Test['moreBug1']>; type mapper_moreTest2 = Mapper<Test['moreBug2']>; type mapper2_bug = Mapper2<Test['bug']>; type mapper2_fix = Mapper2<Test['fix']>;
the mapper ignore the field declaration !!
the mapper should consider the field declaration !
No, but I just spent a whole day trying to understand before realizing that it's a TypeScript issue! I am exhausted.
please test the play ground in both version : 5.6.3 and 5.7.3
The text was updated successfully, but these errors were encountered:
Bisects to #59282
Sorry, something went wrong.
class C { annotated: number = 1; unannotated = 2; } type Mapper<T> = { [k in keyof T]: k } type mapper_bug = Mapper<C>; // work in version: 5.6.3 // ^? // Actual // { annotated: "annotated"; unannotated: number } // Expected // { annotated: "annotated"; unannotated: "unannotated" }
weswigham
No branches or pull requests
π Search Terms
Mapper class explicite inference for primitive
π Version & Regression Information
β― Playground Link
PLAYGROUND
if need, here is a very simple and epurate playground without all the tests.
SMALL_PLAYGROUND
π» Code
I have added some additional tests in order to gather more information and understand what is happening.
Bugs and fixes are the two adresse to verify.
π Actual behavior
the mapper ignore the field declaration !!
π Expected behavior
the mapper should consider the field declaration !
Additional information about the issue
No, but I just spent a whole day trying to understand before realizing that it's a TypeScript issue! I am exhausted.
please test the play ground in both version : 5.6.3 and 5.7.3
The text was updated successfully, but these errors were encountered: