/
genericIndexedAccessMethodIntersectionCanBeAccessed.types
59 lines (46 loc) · 2.23 KB
/
genericIndexedAccessMethodIntersectionCanBeAccessed.types
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
=== tests/cases/compiler/genericIndexedAccessMethodIntersectionCanBeAccessed.ts ===
type ExtendedService<T> = {
>ExtendedService : ExtendedService<T>
[K in keyof T]: T[K] & {
__$daemonMode?: string;
>__$daemonMode : string | undefined
__$action?: string;
>__$action : string | undefined
};
};
type Service<T> = {
>Service : Service<T>
[K in keyof T]: T[K] & {id?: string};
>id : string | undefined
};
export const createService = <T>(
>createService : <T>(ServiceCtr: ExtendedService<T> & Service<T>) => void
><T>( ServiceCtr: ExtendedService<T> & Service<T>) => { Object.keys(ServiceCtr).forEach(key => { const method = (ServiceCtr)[key as keyof T]; const {__$daemonMode, __$action, id} = method; })} : <T>(ServiceCtr: ExtendedService<T> & Service<T>) => void
ServiceCtr: ExtendedService<T> & Service<T>
>ServiceCtr : ExtendedService<T> & Service<T>
) => {
Object.keys(ServiceCtr).forEach(key => {
>Object.keys(ServiceCtr).forEach(key => { const method = (ServiceCtr)[key as keyof T]; const {__$daemonMode, __$action, id} = method; }) : void
>Object.keys(ServiceCtr).forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
>Object.keys(ServiceCtr) : string[]
>Object.keys : (o: object) => string[]
>Object : ObjectConstructor
>keys : (o: object) => string[]
>ServiceCtr : ExtendedService<T> & Service<T>
>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
>key => { const method = (ServiceCtr)[key as keyof T]; const {__$daemonMode, __$action, id} = method; } : (key: string) => void
>key : string
const method = (ServiceCtr)[key as keyof T];
>method : (ExtendedService<T> & Service<T>)[keyof T]
>(ServiceCtr)[key as keyof T] : (ExtendedService<T> & Service<T>)[keyof T]
>(ServiceCtr) : ExtendedService<T> & Service<T>
>ServiceCtr : ExtendedService<T> & Service<T>
>key as keyof T : keyof T
>key : string
const {__$daemonMode, __$action, id} = method;
>__$daemonMode : string | undefined
>__$action : string | undefined
>id : string | undefined
>method : (ExtendedService<T> & Service<T>)[keyof T]
})
}