Skip to content

Commit 59e7b9d

Browse files
committed
Update node types.isMap tests
microsoft/TypeScript#49625 improves handling of unions in type predicates so that unions are correctly preserved. This breaks types.isMap in node. For now I just changed the tests' expected type, but the type of isMap doesn't make much sense to me. It should probably be changed, but that's a much more complex task. This break is tracked at microsoft/TypeScript#49988 although it's correct, I think, so not very likely to be reverted.
1 parent 0096577 commit 59e7b9d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

types/node/test/util_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if (types.isMap(object)) {
6060
object; // $ExpectType Map<unknown, unknown>
6161

6262
if (types.isMap(readonlyMapOrRecord)) {
63-
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any>
63+
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any> || ReadonlyMap<any, any> | Map<unknown, unknown>
6464
}
6565
}
6666
if (types.isNativeError(object)) {

types/node/v14/test/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function testUtilTypes(
257257
object; // $ExpectType Map<any, any>
258258

259259
if (util.types.isMap(readonlyMapOrRecord)) {
260-
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any>
260+
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any> || Map<any, any> | ReadonlyMap<any, any>
261261
}
262262
}
263263
if (util.types.isNativeError(object)) {

types/node/v16/test/util_types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ if (types.isInt16Array(object)) {
5656
if (types.isInt32Array(object)) {
5757
object; // $ExpectType Int32Array
5858
}
59+
5960
if (types.isMap(object)) {
6061
object; // $ExpectType Map<unknown, unknown>
6162

6263
if (types.isMap(readonlyMapOrRecord)) {
63-
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any>
64+
readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any> || ReadonlyMap<any, any> | Map<unknown, unknown>
6465
}
6566
}
6667
if (types.isNativeError(object)) {

0 commit comments

Comments
 (0)