@@ -10,7 +10,7 @@ function f1<T>(x: T) {
10
10
>x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 0, 15))
11
11
12
12
g(x);
13
- >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 10 , 1))
13
+ >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 24 , 1))
14
14
>x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 0, 15))
15
15
}
16
16
}
@@ -26,12 +26,60 @@ function f2<T extends unknown>(x: T) {
26
26
>x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 6, 31))
27
27
28
28
g(x);
29
- >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 10 , 1))
29
+ >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 24 , 1))
30
30
>x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 6, 31))
31
31
}
32
32
}
33
33
34
+ // #48468 but with an explicit constraint so as to not trigger the `{}` and unconstrained type parameter bug
35
+ function deepEquals<T extends unknown>(a: T, b: T) {
36
+ >deepEquals : Symbol(deepEquals, Decl(unconstrainedTypeParameterNarrowing.ts, 10, 1))
37
+ >T : Symbol(T, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 20))
38
+ >a : Symbol(a, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 39))
39
+ >T : Symbol(T, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 20))
40
+ >b : Symbol(b, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 44))
41
+ >T : Symbol(T, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 20))
42
+
43
+ if (typeof a !== "object" || typeof b !== "object" || !a || !b) {
44
+ >a : Symbol(a, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 39))
45
+ >b : Symbol(b, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 44))
46
+ >a : Symbol(a, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 39))
47
+ >b : Symbol(b, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 44))
48
+
49
+ return false;
50
+ }
51
+ if (Array.isArray(a) || Array.isArray(b)) {
52
+ >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
53
+ >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
54
+ >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
55
+ >a : Symbol(a, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 39))
56
+ >Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
57
+ >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
58
+ >isArray : Symbol(ArrayConstructor.isArray, Decl(lib.es5.d.ts, --, --))
59
+ >b : Symbol(b, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 44))
60
+
61
+ return false;
62
+ }
63
+ if (Object.keys(a).length !== Object.keys(b).length) {
64
+ >Object.keys(a).length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
65
+ >Object.keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --))
66
+ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
67
+ >keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --))
68
+ >a : Symbol(a, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 39))
69
+ >length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
70
+ >Object.keys(b).length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
71
+ >Object.keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --))
72
+ >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
73
+ >keys : Symbol(ObjectConstructor.keys, Decl(lib.es5.d.ts, --, --))
74
+ >b : Symbol(b, Decl(unconstrainedTypeParameterNarrowing.ts, 13, 44))
75
+ >length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
76
+
77
+ return false;
78
+ }
79
+ return true;
80
+ }
81
+
34
82
function g(x: object) {}
35
- >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 10 , 1))
36
- >x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 12 , 11))
83
+ >g : Symbol(g, Decl(unconstrainedTypeParameterNarrowing.ts, 24 , 1))
84
+ >x : Symbol(x, Decl(unconstrainedTypeParameterNarrowing.ts, 26 , 11))
37
85
0 commit comments