-
-
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
[2.7.x] [typescript] Type inference breaks under specific circumstances #12628
Comments
I ran into the next few issues when upgrading from 2.6 to 2.7.3. return createElement(
VSwitch,
{
on: this.$listeners
}
)
export default defineComponent({
name: 'x-expansion-panel-header',
extends: VExpansionPanelHeader,
})
createElement('div', { props }, [...this.$slots.default])
export default defineComponent({
...
methods: {
wrapWithLabel(): VNode {
...
return this.$createElement(XFormLabel, { props }, children)
},
},
}
|
I can't get props to infer to anything other than |
I define properties like: {
props: {
thestring: { type: String } as PropOptions<string | undefined>
},
} And that seems to infer correctly. |
closed via 1d5a411 |
Great, thanks! |
Thanks, 1d5a411 is indeed fixed case when component is import App from "./App.vue"; I've updated vue to 2.7.4 in my example repo, error is still here. |
@yyx990803 please reopen this, it isn't fixed yet. https://github.com/last-partizan/vue-examples/tree/11c64acb67a3aaba788f6e4275405b2cc37d1f5a With
|
For components that do not use props, it is possible to fix this by putting the data() part at the very bottom of the defineComponent statement. |
We just made the move to replace all |
This bug still exists in 2.7.14 |
Just ran into this with 2.7.14 as well. A lot of instances of error TS2339. I tried all the solutions here. Replacing If I follow the vue 2 docs and take So I have exactly the same problem as @jorisvergeer mentions above. I feel like I'm going around in circles and cannot figure out how to make this work. Is there a working solution somewhere? |
This is still broken for me in 2.7.14 and I installed vue-tsc ^1.2.0 |
I think we should reopen this issue ? |
Still experiencing this issue. Moving |
Still got lots of TS2339 errors in |
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
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
…x one error (still fails) Merely moving the property after another fixes a Typescript error. I'm baffled. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. This fixes one of three Vue/Typescript errors: 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: ...'. Related: * vuejs/vue#12628 (comment)
* 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
…ill fails with one kind of TS error) Merely moving the property after another fixes a Typescript error. I'm baffled. This fixes one of three Vue/Typescript errors: 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: ...'. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. Related: * vuejs/vue#12628 (comment)
* 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
…ill fails with one kind of TS error) Merely moving the property after another fixes a Typescript error. I'm baffled. This fixes one of three Vue/Typescript errors: 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: ...'. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. Related: * vuejs/vue#12628 (comment)
* 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>
…ill fails with one kind of TS error) Merely moving the property after another fixes a Typescript error. I'm baffled. This fixes one of three Vue/Typescript errors: 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: ...'. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. Related: * vuejs/vue#12628 (comment) 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>
…ill fails with one kind of TS error) Merely moving the property after another fixes a Typescript error. I'm baffled. This fixes one of three Vue/Typescript errors: 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: ...'. Still fails with two other errors where Typescript can't infer types on properties referenced via this.$refs. Related: * vuejs/vue#12628 (comment) Signed-off-by: Thomas Lehmann <t.lehmann@strato.de>
Version
2.7.3
Reproduction link
github.com
Or just create this file in minimal vue-ts (v2) project
Steps to reproduce
Clone example repo, run
pnpm install
, runpnpm vue-tsc --noEmit
What is expected?
No errors.
What is actually happening?
Has ts errors.
I'm updating our app from
vue-2.6 + @vue/composition-api
tovue-2.7
, and after update i see many type checking erros.If you replace import from "vue" to import from "@vue/composition-api", it works fine.
If you remove
data
orcomponents
, it works fine.The text was updated successfully, but these errors were encountered: