2

I have an ASP .NET Core project with a Vue front end. This was made using:

dotnet new — install Microsoft.AspNetCore.SpaTemplates::*

dotnet new vue

This builds and runs fine but when I try and add vuex for state management I get a list of errors.

If I add vuex by running:

npm install --save vuex

and then whenever I try and add:

import Vuex from 'vuex'

the error list looks like:

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:45 TS1005: ';' expected.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:79 TS1005: ';' expected.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:67 TS1005: ';' expected.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:100 TS1005: '=' expected.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:115 TS1005: ';' expected.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:73 TS2304: Cannot find name 'infer'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:79 TS2304: Cannot find name 'R'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:89 TS2304: Cannot find name 'R'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:5:93 TS2304: Cannot find name 'never'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:85 TS2370: A rest parameter must be of an array type.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:94 TS2304: Cannot find name 'infer'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:100 TS2304: Cannot find name 'Args'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:109 TS2304: Cannot find name 'infer'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:115 TS2304: Cannot find name 'R'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:120 TS2370: A rest parameter must be of an array type.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:129 TS2304: Cannot find name 'Args'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:138 TS2304: Cannot find name 'R'.

ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:142 TS2304: Cannot find name 'never'.

I have looked around but can't find anyone else having this problem. Looks like there's an issue with typescript and vuex? I am running the latest version of typescript in my application.

Here's my tsconfig.json

"compilerOptions": {
  "allowSyntheticDefaultImports": true,
  "experimentalDecorators": true,
  "module": "es2015",
  "moduleResolution": "node",
  "target": "es2015",
  "sourceMap": true,
  "skipDefaultLibCheck": true,
  "strict": true,
  "types": [ "webpack-env" ],
  "strictFunctionTypes": false
},
"exclude": [
  "bin",
  "node_modules"
 ]

}

Is there anything else that people are using for state management in their apps? I want to make a 'user' entity available through the components. Global mixins didn't seem to be quite right so I though vuex would do it.

Thanks

1
  • can you also share tsconfig.json? Commented May 17, 2020 at 21:12

1 Answer 1

1
+50

Have you tried running the "npm update" command from within your project? On the face of it, it seems your tsconfig.js file is fine.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks. that seems to have fixed most of it but I am still getting a couple of errors: ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:85 TS2370: A rest parameter must be of an array type. ERROR in [at-loader] ./node_modules/vuex/types/helpers.d.ts:8:120 TS2370: A rest parameter must be of an array type.
updated the typescript version and these have gone now. All seems to be working now. Thanks for your help
You are very welcome, best of luck with your project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.