-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "drop pre-TS-4.1 types and workarounds (#2249)"
This reverts commit 48689d4.
- Loading branch information
Showing
9 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file is a dummy. In actual dev, we re-export the hooks type | ||
// here. But, when published, the package.json in this folder will | ||
// point TS to either ts40Types.d.ts or ts41Types.d.ts, and bypass | ||
// index.d.ts completely. | ||
// Overall, this setup allows us to selectively override the one | ||
// file that has any difference between 4.1 and earlier, without | ||
// having to ship two completely duplicate copies of our typedefs. | ||
export { HooksWithUniqueNames } from './ts41Types' |
10 changes: 10 additions & 0 deletions
10
packages/toolkit/src/query/react/versionedTypes/package.dist.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"typesVersions": { | ||
">=4.1": { | ||
"index": ["./ts41Types.d.ts"] | ||
}, | ||
"<4.1": { | ||
"index": ["./ts40Types.d.ts"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { EndpointDefinitions } from '@reduxjs/toolkit/dist/query/endpointDefinitions' | ||
|
||
// For TS 4.0 and earlier, disallow use of the per-endpoint | ||
// hooks defined at the root of each API object, because we | ||
// can't use the string literal types here. | ||
export declare type HooksWithUniqueNames< | ||
Definitions extends EndpointDefinitions | ||
> = unknown | ||
export {} |
4 changes: 3 additions & 1 deletion
4
...ges/toolkit/src/query/react/namedHooks.ts → ...c/query/react/versionedTypes/ts41Types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters