Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fixing createAsyncThunk issues with TS 4.8 #2643

Merged
merged 2 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .yarn/patches/msw-npm-0.40.2-2107d48752
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/lib/types/context/set.d.ts b/lib/types/context/set.d.ts
index 266229bad706ec49392b8b87e18560c1566b490d..4fad485f8ffec2db92e808a05ccd9274414a9bd9 100644
--- a/lib/types/context/set.d.ts
+++ b/lib/types/context/set.d.ts
@@ -15,4 +15,5 @@ export declare type ForbiddenHeaderError<HeaderName extends string> = `SafeRespo
* })
* @see {@link https://mswjs.io/docs/api/context/set `ctx.set()`}
*/
+// @ts-ignore
export declare function set<N extends string | HeadersObject>(...args: N extends string ? Lowercase<N> extends ForbiddenHeaderNames ? ForbiddenHeaderError<N> : [N, string] : N extends HeadersObject<infer CookieName> ? Lowercase<CookieName> extends ForbiddenHeaderNames ? ForbiddenHeaderError<CookieName> : [N] : [N]): ResponseTransformer;
diff --git a/lib/types/sharedOptions.d.ts b/lib/types/sharedOptions.d.ts
index d1d6e05df2dc2c29f06d8d0b91c500a10e651a29..3d8c29fd2089b2abf21d78cd277aac9271e781c2 100644
--- a/lib/types/sharedOptions.d.ts
+++ b/lib/types/sharedOptions.d.ts
@@ -21,4 +21,5 @@ export interface LifeCycleEventsMap<ResponseType> {
'response:bypass': (response: ResponseType, requestId: string) => void;
unhandledException: (error: Error, request: MockedRequest) => void;
}
+// @ts-ignore
export declare type LifeCycleEventEmitter<ResponseType> = Pick<StrictEventEmitter<ResponseType>, 'on' | 'removeListener' | 'removeAllListeners'>;
2 changes: 1 addition & 1 deletion examples/query/react/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/jest": "^26.0.23",
"@types/react": "^18.0.5",
"@types/react-dom": "^18.0.5",
"msw": "^0.41.1",
"msw": "^0.40.2",
"typescript": "~4.2.4"
},
"eslintConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/query/react/graphql-codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"framer-motion": "^2.9.5",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"msw": "0.28.2",
"msw": "0.40.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "3.11.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/query/react/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"framer-motion": "^2.9.5",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"msw": "0.28.2",
"msw": "0.40.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-icons": "3.11.0",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"resolutions": {
"console-testing-library": "patch:console-testing-library@npm:0.3.1#.yarn/patches/console-testing-library__npm_0.3.1.patch",
"msw": "patch:msw@npm:0.40.2#.yarn/patches/msw-npm-0.40.2-2107d48752",
"react-redux": "npm:8.0.2",
"react": "npm:18.1.0",
"react-dom": "npm:18.1.0",
Expand All @@ -51,7 +52,8 @@
"docs/react": "npm:17.0.2",
"docs/react-dom": "npm:17.0.2",
"docs/@types/react-dom": "npm:17.0.11",
"docs/@types/react": "npm:17.0.11"
"docs/@types/react": "npm:17.0.11",
"type-fest": "2.19.0"
},
"scripts": {
"build": "yarn build:packages",
Expand Down
2 changes: 1 addition & 1 deletion packages/rtk-query-codegen-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"esbuild-runner": "^2.2.1",
"husky": "^4.3.6",
"jest": "^27",
"msw": "^0.41.1",
"msw": "^0.40.2",
"openapi-types": "^9.1.0",
"pretty-quick": "^3.1.0",
"ts-jest": "^27",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"json-stringify-safe": "^5.0.1",
"magic-string": "^0.25.7",
"merge-source-map": "^1.1.0",
"msw": "^0.41.1",
"msw": "^0.40.2",
"node-fetch": "^2.6.1",
"prettier": "^2.2.1",
"query-string": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ type OverrideThunkApiConfigs<OldConfig, NewConfig> = Id<
NewConfig & Omit<OldConfig, keyof NewConfig>
>

type CreateAsyncThunk<CurriedThunkApiConfig> = {
type CreateAsyncThunk<CurriedThunkApiConfig extends AsyncThunkConfig> = {
/**
*
* @param typePrefix
Expand Down
4 changes: 2 additions & 2 deletions packages/toolkit/src/query/react/buildHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ import type { BaseQueryFn } from '../baseQueryTypes'
// Copy-pasted from React-Redux
export const useIsomorphicLayoutEffect =
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
!!window.document &&
!!window.document.createElement
? useLayoutEffect
: useEffect

Expand Down
Loading