I am building a nuxt.js app with typescript and want to separate the API Calls from the vuex store. But it seems like I can not use the methods when I import the class. The compiler also only says TS1005: ',' expected. when I am trying to call a method.
apiClient.ts
export default class apiClient {
helloWorld() {
console.log('Hello World');
}
}
products.ts:
import ApiClient from '../services/apiClient';
export const actions = {
ApiClient.helloWorld();
};
tsconfig.json
"compilerOptions": {
"target": "ES2018",
"module": "ESNext",
"moduleResolution": "Node",
"lib": [
"ESNext",
"ESNext.AsyncIterable",
"DOM"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"experimentalDecorators": true,
"noImplicitAny": false,
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
],
"@/*": [
"./src/*"
]
},
"types": [
"@types/node",
"@nuxt/types",
"@nuxtjs/axios"
]
},