-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property 'xxx' does not exist on type CombinedVueInstance ? #8721
Comments
It seems to be intentional, I guess so you can't accidentally access computed properties via a method? Line 34 in 3b43c81
edit: 540a38f, #5887 (comment) |
I don't understand. What bad would happen if i access computed properties via a method ? |
They don't exist yet: https://codepen.io/kaelwd/pen/pOErZw?editors=0011 |
Yeah I know, it is a bit silly. Just a guess as to why they might've done that. |
Same here.
Is there any way to access methods in |
Since this appears to be only a typing issue and not a runtime issue, there is an (ugly?) workaround available: cast
Additionally omit the |
Same here. Vue 2.5 has better type declaration support for TypeScript but this seems broken. |
Same problem for me |
I guess we should remove I also faced another use case which I need comprehensive data() {
return {
someFunc: () => {
this.someComputed() // `this` type here should be comprehensive
}
}
} As a similar case, But they probably breaks existing apps type checking as we need to explicitly declare |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So is this the proposed solution at the moment? |
One workaround I had been using is to add an Interface for the Vue instance like this:
This will let you add typing for methods and $refs, does not seem to be any side effects. EDIT: I will add this too since I struggled to work with the types for nullable properties (late initialization) with Vue.extend. if you try to return a type | null that is initialized as null, the typings think its literally null and that it cannot be the type. Workaround is to cast the return again, which is annoying so I made a wrapper type. This works well if you have data that needs to be set in mounted, or is a component level data that maybe doesn't get initialized until a certain method is called (Form validator and Dialog reference in UI framework in my cases:
|
EDIT: See @IAMtheIAM's answer below I had this error while working inside of a computed property. My data and computed were organized like this:
It would give me the same error ( However, when I declared what type would be returned by the function, the error went away:
Hope this helps! |
Declare the return type worked for me as well... But such strange behavior. |
FWIW, the error shows for me only in VSCode, but when compiling with |
Declare the return type worked for me sometimes, but turn to |
Same here. Odd behavior but it works nonetheless. I supposed having a return in TypeScript never hurts haha! |
This happens for all my methods and data properties. What's the solution? UPDATE: Apparently, you have to annotate the return type for your computed methods, otherwise all your |
Thanks @IAMtheIAM, your hint solved it for me. I was having the issue with |
I had this issue until I gave all my computed properties return types. I had to alter my expectation to follow this pattern: expect((wrapper.vm as any).subtotalFormatted).toBe('£1,234.56'); Yuk! I hope this can be resolved soon. |
I have this issue - but 'computed' statement is nowhere in my dummy project. I'm using just 'methods'. Basically reproduction is the same as the original post at the top. I tried the solution with the type declaration, this didn't help me (ts 3.8.3) |
I am still experiencing the problems described in this ticket.. :-/ My Setup:
<template>
<div>Hello World 2</div>
</template>
<script lang="ts">
<template>
<div>Hello World 2</div>
</template>
<script lang="ts">
import { defineComponent, PropType } from 'vue';
interface IHelloWorldObject {
helloWorld: string;
}
interface IGoodbyeWorldObject {
goodByWorld: string;
}
interface IData {
goodByWorld: string;
goodByWorldObject: IGoodbyeWorldObject;
}
export default defineComponent({
name: 'HelloWorld',
props: {
helloWorld: {
type: String,
default: 'hello world',
validator(value: string): boolean {
return [
'hello-world',
'hello world',
'hello.world',
].includes(value);
},
},
helloWorldObject: {
type: Object as PropType<IHelloWorldObject>,
required: true,
},
},
data(): IData {
return {
goodByWorld: 'Good By World',
goodByWorldObject: {
goodByWorld: 'Good By World Object',
}
};
},
computed: {
halloWorldExtended(): string {
// Property this.helloWorldObject does not exist on type ComponentPublicInstance
return `${this.helloWorldObject.helloWorld}!`;
},
},
mounted () {
// Property this.helloWorldObject does not exist on type ComponentPublicInstance
console.log(this.helloWorldObject.helloWorld)
// Property this.helloWorldObject does not exist on type ComponentPublicInstance
console.log(this.helloWorld)
console.log(this.goodByWorld)
console.log(this.goodByWorldObject.goodByWorld)
}
});
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped></style> I typed all return types of methods in computed / data. Typescript still says, that props being used in a method in computed / lifecycle / methods do not exist.. UpdateIt turned out, that the problem was the way, how my prop validator is written:
After I figured it out, I have found other tickets describing this issue: |
My problem is the same. Through the computed of mixins, I can't find its declaration on the component. So is there a better solution now? |
Adding a type to all computed properties fixed it here. |
I had the same error after adding head() section to nuxt vue page. After adding return type :any to head, the error disappeared. Maybe this will be helpful to somebody. head(): any { |
I encountered this issue when trying to import non-ts component and use it inside ts component. Tried every fix and finally got it work by rewrite the imported component with ts. This might be useful for people migrating to ts. |
#8721 (comment) |
I have a somehow related type error as soon as switching from In my case, the error The exact same problem appear in the IDE when using Volar (vuejs/language-tools#1996 (comment)). |
Maybe you haven't turned on the
|
We can't turn on strict mode yet. However, we migrated to Vue 3 in the meantime. From our side this issue is not relevant anymore. |
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud, Vue, typescipt dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * tsconfig: extend from @vue/tsconfig/tsconfig.json as documented elsewhere and as done in Nextcloud's core tsconfig.json * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
COMMIT DESC *** * package.json: add Nextcloud dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. ---------------------- * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. ---------------------- Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
COMMIT DESC *** * package.json: add Nextcloud dependencies (from Nextcloud) * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. ---------------------- * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent: ERROR in [eslint] /app/src/components/AuthTokenSection.vue 35:27 error "@nextcloud/initial-state" is not published n/no-unpublished-import 36:32 error "@nextcloud/l10n" is not published n/no-unpublished-import I can only assume that that rule is disabled in the rule set we extend from or that the module resolution "node" can not find the files. The error actually complains about the module not being part of "dependencies" in package.json, which is the case, however. The internet calls for allowing such modules, which IMO defeats the purpose. The rule is also present in Nextcloud's core config. ---------------------- Build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud dependencies (from Nextcloud) * main.ts: register pinia Otherwise the following error would be thrown: TypeError: Cannot read properties of undefined (reading '_s') at i (pinia.mjs:1714:20) at setup (AuthTokenList.vue:11:32) at mn (vue.runtime.esm.js:3033:30) at vue.runtime.esm.js:2457:27 ... * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent import path errors The build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud dependencies (from Nextcloud) * main.ts: register pinia Otherwise the following error would be thrown: TypeError: Cannot read properties of undefined (reading '_s') at i (pinia.mjs:1714:20) at setup (AuthTokenList.vue:11:32) at mn (vue.runtime.esm.js:3033:30) at vue.runtime.esm.js:2457:27 ... * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent import path errors The build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway
* package.json: add Nextcloud dependencies (from Nextcloud) * main.ts: register pinia Otherwise the following error would be thrown: TypeError: Cannot read properties of undefined (reading '_s') at i (pinia.mjs:1714:20) at setup (AuthTokenList.vue:11:32) at mn (vue.runtime.esm.js:3033:30) at vue.runtime.esm.js:2457:27 ... * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent import path errors The build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway Signed-off-by: Thomas Lehmann <t.lehmann@strato.de>
* package.json: add Nextcloud dependencies (from Nextcloud) * main.ts: register pinia Otherwise the following error would be thrown: TypeError: Cannot read properties of undefined (reading '_s') at i (pinia.mjs:1714:20) at setup (AuthTokenList.vue:11:32) at mn (vue.runtime.esm.js:3033:30) at vue.runtime.esm.js:2457:27 ... * remove .ts suffix from import paths (causes build error otherwise) * add declare global to define Nextcloud types. This should be changed to @nextcloud/typings. * annotated import of Nextcloud components (JS) with @ts-expect-error to solve tsc errors. This is most likely due to missing type definitions. Unclear how Nextcloud core made this working. * the eslint rule set @nextcloud/eslint-config/typescript was added to prevent import path errors The build fails with errors like ERROR in /app/src/components/AuthTokenSetup.vue.ts 47:9-14 [tsl] ERROR in /app/src/components/AuthTokenSetup.vue.ts(47,10) TS2339: Property 'reset' does not exist on type 'CreateComponentPublicInstance<{}, { authTokenStore: Store<"auth-token", { tokens: IToken[]; }, {}, { updateToken(token: IToken): Promise<any>; addToken(name: string): Promise<ITokenResponse | null>; deleteToken(token: IToken): Promise<...>; wipeToken(token: IToken): Promise<...>; renameToken(token: IToken, newName: ...'. This hints at Typescript not being able to infer types from the component definition. Related issues: * vuejs/vue#9873 * vuejs/vue#12628 * vuejs/vue#8721 Unsuccessfully attempted proposed solutions: * Declaring return types on methods like: reset(): void { async submit(): Promise<void> { * Using arrow functions Did not work and would introduce new errors anyway * Defining interfaces for the returned component Caused another rabbit hole of more and more required type definitions, that should be infered by the Vue typings anyway Signed-off-by: Thomas Lehmann <t.lehmann@strato.de>
Version
2.5.17
Reproduction link
Steps to reproduce
What is expected?
How can i fix it ?
What is actually happening?
Property 'initData' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<{ msg: string; }>>'.
The text was updated successfully, but these errors were encountered: