Skip to content

Commit 3673a79

Browse files
Update incorrectly-authored test.
1 parent 394f776 commit 3673a79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/cases/compiler/contextualNarrowingFromUnknownToObjects.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
declare function keysOfEmptyObject(o: {}): string[];
66
declare function keysOfNonPrimitive(o: object): string[];
77

8-
namespace explicitConstraints {
8+
namespace implicitConstraints {
99
export function keyLengthsEqualUsingEmptyObjectFn<T>(a: T, b: T): [T, T] | undefined {
1010
if (typeof a !== "object" || typeof b !== "object" || !a || !b) {
1111
return undefined;
@@ -26,7 +26,7 @@ namespace explicitConstraints {
2626
if (Array.isArray(a) || Array.isArray(b)) {
2727
return undefined;
2828
}
29-
if (keysOfEmptyObject(a).length !== keysOfEmptyObject(b).length) {
29+
if (keysOfNonPrimitive(a).length !== keysOfNonPrimitive(b).length) {
3030
return [a, b];
3131
}
3232
return undefined;
@@ -35,7 +35,7 @@ namespace explicitConstraints {
3535

3636
// Explicit Constraints of 'unknown'
3737
namespace explicitConstraintsOfUnknown {
38-
export function keyLengthsEqualUsingEmptyObjectFn<T>(a: T, b: T): [T, T] | undefined {
38+
export function keyLengthsEqualUsingEmptyObjectFn<T extends unknown>(a: T, b: T): [T, T] | undefined {
3939
if (typeof a !== "object" || typeof b !== "object" || !a || !b) {
4040
return undefined;
4141
}
@@ -48,14 +48,14 @@ namespace explicitConstraintsOfUnknown {
4848
return undefined;
4949
}
5050

51-
export function keyLengthsEqualUsingNonPrimitiveFn<T>(a: T, b: T): [T, T] | undefined {
51+
export function keyLengthsEqualUsingNonPrimitiveFn<T extends unknown>(a: T, b: T): [T, T] | undefined {
5252
if (typeof a !== "object" || typeof b !== "object" || !a || !b) {
5353
return undefined;
5454
}
5555
if (Array.isArray(a) || Array.isArray(b)) {
5656
return undefined;
5757
}
58-
if (keysOfEmptyObject(a).length !== keysOfEmptyObject(b).length) {
58+
if (keysOfNonPrimitive(a).length !== keysOfNonPrimitive(b).length) {
5959
return [a, b];
6060
}
6161
return undefined;

0 commit comments

Comments
 (0)