Skip to content
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

[Feature Request] Types not proper for Vuetify 2.0 #7387

Closed
TerenceZ opened this issue Jun 4, 2019 · 7 comments · Fixed by #7878
Closed

[Feature Request] Types not proper for Vuetify 2.0 #7387

TerenceZ opened this issue Jun 4, 2019 · 7 comments · Fixed by #7878
Assignees
Labels
framework Issues and Feature Requests that have needs framework-wide. P: critical The issue is of critical importance S: has PR The issue has a pending Pull Request T: feature A new feature typescript
Milestone

Comments

@TerenceZ
Copy link

TerenceZ commented Jun 4, 2019

Problem to solve

Make Vuetify 2.0 work properly with Typescript and JSX.

Proposed solution

When I use Vuetify 2.0 with Typescript and JSX (created by vue-cli), some types are not proper.

  1. Vuetify 2.0 not handle options like lang, theme, etc., instead, it use new Vuetify(options) to handle them, but currently, the types are not correct, the default exported from vuetify isn't constructable through new.
  2. All components are typed as Vue's Component, but vue-cli's generated types for JSX isn't. Instead, vue-cli's JSX component type is VueConstructor (aka, typeof Vue), it makes it's not possible to use vuetify with Typescript + JSX for project generated by vue-cli.
@ghost ghost added the S: triage label Jun 4, 2019
@jacekkarczmarczyk jacekkarczmarczyk added framework Issues and Feature Requests that have needs framework-wide. typescript labels Jun 4, 2019
@TerenceZ
Copy link
Author

TerenceZ commented Jun 4, 2019

Moreover, is it possible to export each component's prop types? So user can use it to work with some libraries, e.g., vue-tsx-support, to get the correct property type check in TSX / TS.

@vortechs2000
Copy link

I'm really confused - it looks like there are type definitions in the vuetify/types directory, but they don't appear to be used. I am not a typescript expert though, so maybe I'm missing some critical information.

@vortechs2000
Copy link

I managed to get past the error (Cannot use 'new' with an expression whose type lacks a call or construct signature.) by hacking a 'new' definition into the types/index.d.ts:

export interface Vuetify {
  new (options: any): any;
  install: PluginFunction<VuetifyUseOptions>
  version: string
}

This probably isn't what you want long term, but it seems to be working for getting things up and running.

@Connect-a

This comment has been minimized.

@Lobosque
Copy link

Lobosque commented Jul 4, 2019

None of the aforementioned solutions worked for me.
Any other suggestion to try testing the beta?

@PaulKujawa
Copy link

@Lobosque
https://github.com/PaulKujawa/eventvuel-client/blob/master/src/plugins/vuetify.ts
https://github.com/PaulKujawa/eventvuel-client/blob/master/src/vue-shims.d.ts#L12

if you care about typings for colors you could add /// <reference path="node_modules/vuetify/types/colors.d.ts" /> before your import. Colleague said they would have to add this line to their types/index.d.ts themselves.

@jacekkarczmarczyk
Copy link
Member

@TerenceZ i've added PR for 1., could you please create a separate issue for 2.? Some reproduction could be also nice, could be a simplified github repo. Thanks

@jacekkarczmarczyk jacekkarczmarczyk added the S: has PR The issue has a pending Pull Request label Jul 5, 2019
KaelWD added a commit that referenced this issue Jul 19, 2019
@johnleider johnleider modified the milestones: v2.0.0, v2.0.x Jul 23, 2019
johnleider pushed a commit that referenced this issue Sep 3, 2019
* fix(types): avoid importing from src

fixes #7040
fixes #7387
fixes #7964

* fix(types): don't use Dictionary<T>

* fix(types): update for v2

* refactor: rename breakpoint interface
johnleider pushed a commit that referenced this issue Sep 20, 2019
* fix(types): avoid importing from src

fixes #7040
fixes #7387
fixes #7964

* fix(types): don't use Dictionary<T>

* fix(types): update for v2

* refactor: rename breakpoint interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework Issues and Feature Requests that have needs framework-wide. P: critical The issue is of critical importance S: has PR The issue has a pending Pull Request T: feature A new feature typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants