-
Notifications
You must be signed in to change notification settings - Fork 71
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
fix: use .d.ts
instead of .vue.d.ts
for Vue declarations
#336
fix: use .d.ts
instead of .vue.d.ts
for Vue declarations
#336
Conversation
- `.vue.d.ts` was recommended by the `rollup-plugin-vue` maintainers back when this code was originally written, but apparently it causes problems with some imports - plain `.d.ts` seems to work fine according to users - and plain is the standard in TS too I believe
This change is breaking Vue type definitions for me. I put up a small repro here: https://github.com/andrew0/rollup-vue-ts-repro. The index.d.ts file contains export { default as MyComponent } from './MyComponent.vue'; so the component's type definition should be |
@andrew0 this isn't the original issue, so I think it would be best to discuss that there.
It's possible, but there isn't a repro there to work off of and deduce. I see that issue got a decent amount of references (and probably has many more if it were not locked), so it sounds very possible that extensionless was pretty commonly used by a variety of users and was even supported by the CLI. It also mentions configuring Webpack for resolving the extension. next stepsI've dug into Vue a bit more in supporting rpt2; I think we'd probably want to follow whatever @andrew0 I think it would still be good for you to comment on the original issue to see what the users there think.
There's another use-case that users might have been talking about too, importing Vue SFCs from each other. e.g. if you had |
I added I went ahead and created a Vue repro environment here (forked from the original Based on this comparison, it seems like we may very well want to revert this PR in the next breaking release ( @andrew0 commenting on the original issue and getting clarification there would still be very helpful. Don't want to churn this more than it has already, and not sure if users there were using a common misconfiguration (well, now it is) or what
It looked like you were using Vue 2 in your repro, though I had the same results with Vue 3 in my repro. Not sure if this might be because of how I haven't yet checked in on Volar and other imports etc (mostly as I'm not a Vue user). |
Thanks a lot for looking into this more, @agilgur5! I agree it makes sense to align with what
I modified your repro a bit to test how
declare const _default: import("vue").DefineComponent<{
b: StringConstructor;
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").DefineComponent<{
a: StringConstructor;
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
a: StringConstructor;
}>>, {}>, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
b: StringConstructor;
}>>, {}>;
export default _default;
declare const _default: import("vue").DefineComponent<{
b: StringConstructor;
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, any, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
b: StringConstructor;
}>>, {}>;
export default _default; So with |
Thanks for engaging @andrew0 🙂
To clarify, Volar only picks this up with the Or does it work with both?
Thanks for the example! I believe this illustrates an existing (and fairly complicated) issue, #129. If I had to guess, |
Summary
For the
rollup-plugin-vue
integration, output declarations asname.d.ts
instead ofname.vue.d.ts
.vue.d.ts
vs..d.ts
#224 , follow-up to Vue declaration files endings --.vue.d.ts
vs..d.ts
#224 (comment)Details
.vue.d.ts
was recommended by therollup-plugin-vue
maintainers inENOENT: no such file or directory, open '...?rollup-plugin-vue=script.d.ts'
#97 (comment) back when this code was originally written, but apparently it causes problems with some imports according to Vue declaration files endings --.vue.d.ts
vs..d.ts
#224.d.ts
seems to work fine according to users in that issue