Skip to content

Commit 2199c0a

Browse files
committed
Add as const to fix failing type test in TypeScript v4.7
1 parent dd7478e commit 2199c0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/toolkit/src/query/tests/queryLifecycle.test-d.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ describe('type tests', () => {
236236
dispatch(
237237
baseApiSlice.util.upsertQueryEntries(
238238
posts.map((post) => ({
239-
endpointName: 'getPostById',
239+
// Without `as const` this will result in a TS error in TS 4.7.
240+
endpointName: 'getPostById' as const,
240241
arg: post.id,
241242
value: post,
242243
})),

0 commit comments

Comments
 (0)