Skip to content

Commit e0cb187

Browse files
committed
Remove as any type assertions inside buildHooks.test.tsx
1 parent 9e3d91a commit e0cb187

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/toolkit/src/query/tests/buildHooks.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ describe('hooks with createApi defaults set', () => {
19791979
http.get('https://example.com/posts', () => {
19801980
return HttpResponse.json(posts)
19811981
}),
1982-
http.put<Post, Partial<Post>>(
1982+
http.put<{ id: string }, Partial<Post>>(
19831983
'https://example.com/post/:id',
19841984
async ({ request, params }) => {
19851985
const body = await request.json();
@@ -2018,7 +2018,7 @@ describe('hooks with createApi defaults set', () => {
20182018
})
20192019

20202020
interface Post {
2021-
id: string
2021+
id: number
20222022
name: string
20232023
fetched_at: string
20242024
}
@@ -2092,7 +2092,7 @@ describe('hooks with createApi defaults set', () => {
20922092
function SelectedPost() {
20932093
const { post } = api.endpoints.getPosts.useQueryState(undefined, {
20942094
selectFromResult: ({ data }) => ({
2095-
post: data?.find((post) => post.id === 1 as any),
2095+
post: data?.find((post) => post.id === 1),
20962096
}),
20972097
})
20982098
getRenderCount = useRenderCounter()
@@ -2171,7 +2171,7 @@ describe('hooks with createApi defaults set', () => {
21712171
isSuccess,
21722172
isError,
21732173
}) => ({
2174-
post: data?.find((post) => post.id === 1 as any),
2174+
post: data?.find((post) => post.id === 1),
21752175
isUninitialized,
21762176
isLoading,
21772177
isFetching,
@@ -2228,7 +2228,7 @@ describe('hooks with createApi defaults set', () => {
22282228
getRenderCount = useRenderCounter()
22292229
const { post } = api.endpoints.getPosts.useQuery(undefined, {
22302230
selectFromResult: ({ data }) => ({
2231-
post: data?.find((post) => post.id === 1 as any),
2231+
post: data?.find((post) => post.id === 1),
22322232
}),
22332233
})
22342234

@@ -2277,7 +2277,7 @@ describe('hooks with createApi defaults set', () => {
22772277
</button>
22782278
<button
22792279
data-testid="updatePost"
2280-
onClick={() => updatePost({ id: 1, name: 'supercoooll!' } as any)}
2280+
onClick={() => updatePost({ id: 1, name: 'supercoooll!' })}
22812281
>
22822282
Update post
22832283
</button>
@@ -2288,7 +2288,7 @@ describe('hooks with createApi defaults set', () => {
22882288
function SelectedPost() {
22892289
const { post } = api.endpoints.getPosts.useQuery(undefined, {
22902290
selectFromResult: ({ data }) => ({
2291-
post: data?.find((post) => post.id === 1 as any),
2291+
post: data?.find((post) => post.id === 1),
22922292
}),
22932293
})
22942294
getRenderCount = useRenderCounter()

0 commit comments

Comments
 (0)