error TS2536: Type 'key' cannot be used to index type 'Store<string, S, G, {}> #2605
Replies: 9 comments 5 replies
-
You will need to provide the code that triggers this error and more information if you want to get help 😉 |
Beta Was this translation helpful? Give feedback.
-
not need any code, just error when build and the error is in d.ts |
Beta Was this translation helpful? Give feedback.
-
it looks like that because typescript upgraded to 5.4 |
Beta Was this translation helpful? Give feedback.
-
Correct faced same thing, especially for getters with objects Updating to Reproduction |
Beta Was this translation helpful? Give feedback.
-
already discard to use pinia |
Beta Was this translation helpful? Give feedback.
-
Downgrading Typescript to
|
Beta Was this translation helpful? Give feedback.
-
i made a repro here that shows upgrading to ts 5.4.5 causes pinia not to type check https://github.com/dten/pinia_ts_repro/actions/runs/8710652508/job/23893007875 |
Beta Was this translation helpful? Give feedback.
-
When I added the following line to the ts compilerOptions, the error fixed: |
Beta Was this translation helpful? Give feedback.
-
gpt 给的答案
|
Beta Was this translation helpful? Give feedback.
-
Reproduction
error TS2536:
Steps to reproduce the bug
354 [key in Keys]: () => Store<string, S, G, {}>[key];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in ../../node_modules/.pnpm/pinia@2.1.7_typescript@5.4.2_vue@3.4.21/node_modules/pinia/dist/pinia.d.ts:354
Expected behavior
it's ok yesterday, I don't know why and which package upgrade bring this
Actual behavior
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions