Skip to content

Commit

Permalink
Fix expectExactType to be compatible with TypeScript 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Jan 25, 2024
1 parent 31c05c9 commit 65dd3a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type Equals<T, U> = IsAny<
IsAny<U, never, [T] extends [U] ? ([U] extends [T] ? any : never) : never>
>
export function expectExactType<T>(t: T) {
return <U extends Equals<T, U>>(u: U) => {}
return <U extends T>(u: U & Equals<T, U>) => {}
}

type EnsureUnknown<T extends any> = IsUnknown<T, any, never>
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/tests/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ type Equals<T, U> = IsAny<
IsAny<U, never, [T] extends [U] ? ([U] extends [T] ? any : never) : never>
>
export function expectExactType<T>(t: T) {
return <U extends Equals<T, U>>(u: U) => {}
return <U extends T>(u: U & Equals<T, U>) => {}
}

type EnsureUnknown<T extends any> = IsUnknown<T, any, never>
Expand Down

0 comments on commit 65dd3a3

Please sign in to comment.