Skip to content

Commit 07d3187

Browse files
committed
fixture: simplify testModel.ts
1 parent 39975a6 commit 07d3187

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

tests/fixtures/testModel.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -607,21 +607,14 @@ interface Indexed {
607607
}
608608
type 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
*

0 commit comments

Comments
 (0)