File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed
Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -607,21 +607,14 @@ interface Indexed {
607607}
608608type IndexType = 'foo' ;
609609
610- type UnionToIntersection < U > = ( U extends any ? ( k : U ) => void : never ) extends ( k : infer I ) => void ? I : never ;
611- type Names = 'foo' | 'bar' ;
612- class ClassIndexTest {
613- public static foo = { payload : [ 'id' ] } as const ;
614- public static bar = { payload : [ 'id' ] } as const ;
615- }
616- type ResponseDistribute < T > = T extends Names
617- ? {
618- [ key in T ] : {
619- status : 'fail' ;
620- data : Record < typeof ClassIndexTest [ T ] [ 'payload' ] [ number ] , string | string [ ] > ;
621- } ;
622- }
623- : never ;
624- type Response = UnionToIntersection < ResponseDistribute < Names > > ;
610+ const ClassIndexTest = {
611+ foo : [ 'id' ] ,
612+ } as const
613+ type Names = keyof typeof ClassIndexTest ;
614+ type ResponseDistribute < T > = T extends Names ? {
615+ [ key in T ] : Record < typeof ClassIndexTest [ T ] [ number ] , string > ;
616+ } : never ;
617+ type IndexRecordAlias = ResponseDistribute < Names > ;
625618
626619/**
627620 * This is a description of TestClassModel
@@ -635,7 +628,7 @@ export class TestClassModel extends TestClassBaseModel {
635628 public indexedTypeToInterface ?: Indexed [ 'interface' ] ;
636629 public indexedTypeToClass ?: Indexed [ 'class' ] ;
637630 public indexedTypeToAlias ?: Indexed [ 'alias' ] ;
638- public indexedResponse ?: Response [ 'foo' ] ;
631+ public indexedResponse ?: IndexRecordAlias [ 'foo' ] ;
639632 /**
640633 * This is a description of a public string property
641634 *
You can’t perform that action at this time.
0 commit comments