error TS2536: Type 'key' cannot be used to index type 'Store<string, S, G, {}> #2605
-
Reproductionerror 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 behaviorit's ok yesterday, I don't know why and which package upgrade bring this Actual behavior
Additional informationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 7 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.
-
Are there any solutions here other than downgrade typescript a whole minor revision? |
Beta Was this translation helpful? Give feedback.
When I added the following line to the ts compilerOptions, the error fixed:
"skipLibCheck": true
see: vuejs/vue-cli#5688