forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconditionalTypeAssignabilityWithSimpleDistribution2.types
More file actions
64 lines (49 loc) · 1.85 KB
/
conditionalTypeAssignabilityWithSimpleDistribution2.types
File metadata and controls
64 lines (49 loc) · 1.85 KB
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
60
61
62
63
64
//// [tests/cases/compiler/conditionalTypeAssignabilityWithSimpleDistribution2.ts] ////
=== conditionalTypeAssignabilityWithSimpleDistribution2.ts ===
type AllKeys<T> = T extends any ? keyof T : never;
>AllKeys : AllKeys<T>
> : ^^^^^^^^^^
type WithKeyOfConstraint<T, K extends keyof T> = unknown;
>WithKeyOfConstraint : unknown
> : ^^^^^^^
type Test1<T> = WithKeyOfConstraint<T, AllKeys<T>>; // ok
>Test1 : unknown
> : ^^^^^^^
type WithAllKeysConstraint<T, K extends AllKeys<T>> = unknown;
>WithAllKeysConstraint : unknown
> : ^^^^^^^
type Test2<T> = WithAllKeysConstraint<T, keyof T>; // ok
>Test2 : unknown
> : ^^^^^^^
declare function test3<T>(
>test3 : <T>(p1: T, p2: T extends any ? T & { css?: unknown; } : never) => void
> : ^ ^^ ^^ ^^ ^^ ^^^^^
p1: T,
>p1 : T
> : ^
p2: T extends any ? T & { css?: unknown } : never,
>p2 : T extends any ? T & { css?: unknown; } : never
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
>css : unknown
> : ^^^^^^^
): void;
const wrapper = <P extends object>(props: P) => {
>wrapper : <P extends object>(props: P) => void
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^
><P extends object>(props: P) => { test3( props, props, // ok );} : <P extends object>(props: P) => void
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^
>props : P
> : ^
test3(
>test3( props, props, // ok ) : void
> : ^^^^
>test3 : <T>(p1: T, p2: T extends any ? T & { css?: unknown; } : never) => void
> : ^ ^^ ^^ ^^ ^^ ^^^^^
props,
>props : P
> : ^
props, // ok
>props : P
> : ^
);
};