Skip to content

Commit 0325f9d

Browse files
committed
Accept new baselines
1 parent b3d3ec9 commit 0325f9d

5 files changed

+22
-62
lines changed

tests/baselines/reference/controlFlowFavorAssertedTypeThroughTypePredicate.errors.txt

-51
This file was deleted.

tests/baselines/reference/controlFlowFavorAssertedTypeThroughTypePredicate.types

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ if (isObject2(obj3)) {
5858
>obj3 : Record<string, unknown>
5959

6060
obj3;
61-
>obj3 : {}
61+
>obj3 : Record<string, unknown>
6262

6363
obj3['attr'];
64-
>obj3['attr'] : any
65-
>obj3 : {}
64+
>obj3['attr'] : unknown
65+
>obj3 : Record<string, unknown>
6666
>'attr' : "attr"
6767
}
6868
// check type after conditional block
@@ -78,11 +78,11 @@ if (isObject2(obj4)) {
7878
>obj4 : Record<string, unknown> | undefined
7979

8080
obj4;
81-
>obj4 : {}
81+
>obj4 : Record<string, unknown>
8282

8383
obj4['attr'];
84-
>obj4['attr'] : any
85-
>obj4 : {}
84+
>obj4['attr'] : unknown
85+
>obj4 : Record<string, unknown>
8686
>'attr' : "attr"
8787
}
8888
// check type after conditional block

tests/baselines/reference/narrowingMutualSubtypes.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ function gg2(x: Record<string, unknown>) {
123123
>x : Record<string, unknown>
124124

125125
x; // {}
126-
>x : {}
126+
>x : Record<string, unknown>
127127
}
128128
else {
129129
x; // Record<string, unknown>
130-
>x : Record<string, unknown>
130+
>x : never
131131
}
132132
x; // Record<string, unknown>
133133
>x : Record<string, unknown>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
tests/cases/compiler/typeGuardNarrowByMutableUntypedField.ts(4,9): error TS2322: Type 'unknown' is not assignable to type 'number'.
2+
3+
4+
==== tests/cases/compiler/typeGuardNarrowByMutableUntypedField.ts (1 errors) ====
5+
declare function hasOwnProperty<P extends PropertyKey>(target: {}, property: P): target is { [K in P]: unknown };
6+
declare const arrayLikeOrIterable: ArrayLike<any> | Iterable<any>;
7+
if (hasOwnProperty(arrayLikeOrIterable, 'length')) {
8+
let x: number = arrayLikeOrIterable.length;
9+
~
10+
!!! error TS2322: Type 'unknown' is not assignable to type 'number'.
11+
}

tests/baselines/reference/typeGuardNarrowByMutableUntypedField.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (hasOwnProperty(arrayLikeOrIterable, 'length')) {
1515

1616
let x: number = arrayLikeOrIterable.length;
1717
>x : number
18-
>arrayLikeOrIterable.length : number
19-
>arrayLikeOrIterable : ArrayLike<any>
20-
>length : number
18+
>arrayLikeOrIterable.length : unknown
19+
>arrayLikeOrIterable : (ArrayLike<any> | Iterable<any>) & { length: unknown; }
20+
>length : unknown
2121
}

0 commit comments

Comments
 (0)