Skip to content

Index signature for type 'string' is missing in type 'GlobalComponents' #5161

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

Closed
jonas-eiselt-fk opened this issue Feb 3, 2025 · 6 comments

Comments

@jonas-eiselt-fk
Copy link

jonas-eiselt-fk commented Feb 3, 2025

Vue - Official extension or vue-tsc version

vue-tsc: 2.2.0

VSCode version

N/A

Vue version

3.5.13

TypeScript version

5.7.3

System Info

N/A

package.json dependencies

See minimal reproduction

Steps to reproduce

  1. Go to https://stackblitz.com/edit/vitejs-vite-7p6yratb?file=src%2FApp.vue&view=editor
  2. Run npm run build in the terminal (if you get EIO: i/o error, write error, just ignore and proceed to next step)
  3. Run npx vue-tsc --noEmit dist/types/App.vue.d.ts

After last step you hopefully get the error:

dist/types/App.vue.d.ts:7:474 - error TS2344: Type 'GlobalComponents' does not satisfy the constraint 'Record<string, Component<any, any, any, ComputedOptions, MethodOptions, {}, any>>'.
  Index signature for type 'string' is missing in type 'GlobalComponents'.

7         myInput: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {}, import("vue").PublicProps, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in dist/types/App.vue.d.ts:7

What is expected?

I expect CreateComponentPublicInstanceWithMixins to be able to accept GlobalComponents as one of its type arguments (I guess...).

What is actually happening?

I don't know. In the minimal reproduction I have:

  • a base component (BaseInput.vue)
  • a component that extends the base component (ExtendedInput.vue)
  • and another component (App.vue) where I use the extended component with a ref attribute. I also use a slot in the App.vue. Note: If I don't provide a slot in App.vue, "GlobalComponents" in the generated d.ts file doesn't seem to be problematic

"myInput" in generated App.vue.d.ts has the type CreateComponentPublicInstanceWithMixins with GlobalComponents as one of its type arguments.

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-7p6yratb?file=src%2FApp.vue&view=editor

Any additional comments?

The problem doesn't exist in 3.5.0-beta.3. Starts appearing in 3.5.0-rc.1 and 3.5.0.

This commit seems suspicious: vuejs/core@42e8df6
What problem did it solve? No tests were added or edited.

@KazariEX
Copy link
Member

KazariEX commented Feb 3, 2025

It has been fixed by the recent commits.

@jonas-eiselt-fk
Copy link
Author

It has been fixed by the recent commits.

Ok, great, when is this fix going to be released?

@aarcoraci
Copy link

I'm still getting his using 2.2.2 of vue-tsc.

This happens to me when I include a custom component library into a vue project (same vue-tsc version)

@Perdolique
Copy link

@KazariEX the bug still exists. I just got it in the v2.2.8. Also, on the reproduction link it's still reproducible with v2.2.8 of the vue-tsc.

@KazariEX
Copy link
Member

Can v3.0.0 (#5261) solve this problem?

@Perdolique
Copy link

@KazariEX 3.0.0-alpha.2 seems okay, when 2.2.8 is triggering error. (Stackblitz)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants