Skip to content

Commit c42a54c

Browse files
authored
fix(types): implemented a workaround to be TS 4.9.x compatible (#1818)
1 parent 3e4e63c commit c42a54c

File tree

3 files changed

+39
-48
lines changed

3 files changed

+39
-48
lines changed

packages/pinia/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
],
7070
"license": "MIT",
7171
"devDependencies": {
72-
"@microsoft/api-extractor": "7.28.6",
72+
"@microsoft/api-extractor": "7.33.6",
7373
"@vue/test-utils": "^2.2.3"
7474
},
7575
"dependencies": {

packages/pinia/src/mapHelpers.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ export type _StoreObject<S> = S extends StoreDefinition<
2929
infer Actions
3030
>
3131
? {
32-
[Id in `${Ids}${MapStoresCustomization extends Record<'suffix', string>
33-
? MapStoresCustomization['suffix']
32+
[Id in `${Ids}${MapStoresCustomization extends Record<
33+
'suffix',
34+
infer Suffix extends string
35+
>
36+
? Suffix
3437
: 'Store'}`]: () => Store<
3538
Id extends `${infer RealId}${MapStoresCustomization extends Record<
3639
'suffix',
37-
string
40+
infer Suffix extends string
3841
>
39-
? MapStoresCustomization['suffix']
42+
? Suffix
4043
: 'Store'}`
4144
? RealId
4245
: string,
@@ -64,8 +67,11 @@ export let mapStoreSuffix = 'Store'
6467
* @param suffix - new suffix
6568
*/
6669
export function setMapStoreSuffix(
67-
suffix: MapStoresCustomization extends Record<'suffix', string>
68-
? MapStoresCustomization['suffix']
70+
suffix: MapStoresCustomization extends Record<
71+
'suffix',
72+
infer Suffix extends string
73+
>
74+
? Suffix
6975
: string // could be 'Store' but that would be annoying for JS
7076
): void {
7177
mapStoreSuffix = suffix

pnpm-lock.yaml

+26-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)