Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vue class based to vue2 with TS support#32

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
matrunchyk wants to merge19 commits intovuejs:main
base:main
Choose a base branch
Loading
frommatrunchyk:vue-class-based-to-vue2

Conversation

matrunchyk
Copy link

No description provided.

@matrunchyk
Copy link
Author

Fixes:#33

@rndmerle
Copy link

Nice! We've to migrate a bunch of components from class to composition functions on our project. I'll start from this, it helps a lot. Thanks ;)

matrunchyk and vidal7 reacted with heart emoji

@rndmerle
Copy link

@matrunchyk I've a bunch of TS errors when trying to build, likeProperty 'init' does not exist on type 'Identifier' any idea?
That'sast-types typings.
I tried with npm and yarn, and with node@12 also.
Since@types/jscodeshift is still 0.7.1 I don't get what's the issue.
I tried to upgrade@types/jscodeshift to 0.11.0, or to downgradejscodeshift to 0.7.1 but it didn't help.

@matrunchyk
Copy link
Author

@rndmerle Yeah I will have to enhance typings by declaring appropriate types/interfaces. For now feel free to ignore issues by specifying: any oras any wherever needed.

rndmerle reacted with thumbs up emoji

@NikhilVerma
Copy link

It would be great if we can update this to use the new Vue 2.7defineComponent instead. Which has much better type inference, however I don't think it supports mixins.

vidal7 reacted with heart emoji

@matrunchyk
Copy link
Author

This is exactly what it does for TS components keeping all the typings.

Btw, I have another script which migrates Vue2 to Vue3 script setup (mixin are also supported). I'll publish/share a repo if someone will be interested.

haydenbbickerton reacted with thumbs up emoji

@NikhilVerma
Copy link

@matrunchyk You are using theVue.extend api. I am talking aboutdefineComponent from Vue 2.7 (and 3) which has much better support for Typescript.

https://blog.vuejs.org/posts/vue-2-7-naruto.html

@matrunchyk
Copy link
Author

Ah you're right@NikhilVerma. I think the argument ofVue.extend anddefineCompontent is compatible, so after using the script you could just Find-Replace all mentions ofVue.extend todefineComponent as-is. That's basically what I did in my projects.

But I agree, we can replace it directly in the migration script itself.

@smk
Copy link

smk commentedMay 18, 2023

Hey@matrunchyk ,

Btw, I have another script which migrates Vue2 to Vue3 script setup (mixin are also supported). I'll publish/share a repo if someone will be interested.

I'd be interested in the Vue 3 script setup version even if only partially working since I have a few (read: hundreds) of components to convert, and any starting point is better than none. 😅 Would you mind sharing it with me?

@Satakshi-ctrl
Copy link

Hi@matrunchyk Can you pls let me know how to use this to convert vue2 class based code with TS to vue3 options api

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@matrunchyk@rndmerle@NikhilVerma@smk@Satakshi-ctrl

[8]ページ先頭

©2009-2025 Movatter.jp