-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Minimal TypeScript support option added #797
base: develop
Are you sure you want to change the base?
Minimal TypeScript support option added #797
Conversation
@igogrek, I think we should wait for vuejs/vue#5887 before even considering adding typescript to webpack template, and even then I don't think this will be a valid option since we try to keep this template minimal and even vuex is not here. |
Well that's sad. While I certainly agree on keeping template as minimal as possible - TypeScript is one of the most needed (or at least most discussed) features missing on vue-cli (see vuejs/vue-cli#263) vuejs/vue#5887 shouldn't break anything but I will double check |
@igogrek, I think with all of discussion around TypeScript we can make a dedicated typescript template, @posva, do you think that's a valid option after vuejs/vue#5887 gets merged? P.S. I really think vuejs/vue#5887 will be a big change for typescript support since it will make it possible to not use |
@nickmessing makes sense to wait for #5887. |
Hey~you forget unit tests |
@yalishizhude |
…pt-option # Conflicts: # template/package.json
Updated the fork and dependencies versions. @yalishizhude Waiting for 2.5 for now, to be able to update TypeScript usages properly (definitions are merged already). |
@solarhell I've updated PR again to use Vue.extend() now. Couldn't find any docs for the new intended TypeScript definition usage, but this approach seems best and autocompletion works great. Tested different combinations with different ESLint settings and everything seem to work now. |
"compilerOptions": { | ||
"module": "es2015", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed anymore I presume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, removed. Thanks.
For anyone wanting to give this PR a try you can use:
|
@igogrek did you have plans to convert the included unit test as well? I would find it strange to generate a TS project and to have some of the files still be Javascript. I bring this up because if you do convert it over, at a minimum you'll need to include the |
More or less, but not really.
Just check out the diff to see what UP did. BTW once #1218 is merged I will merge this next. I just wanted to have a flexible testing setup first to test the template with and without typescript in CI. |
Hi guys, This PR for fork-ts-checker-weback-plugin will TypeCheck and TSLint the typescript blocks in Vue SFCs. We're hoping to merge it in soon but you can test it out with the built repo: Also, use the shorter And for VSCode there is TSLint Vue which works on your |
|
When TypeScript is chosen, Maybe we could try https://github.com/nzakas/eslint-plugin-typescript ? This could allow to run "eslint --fix" after generating the project. |
# Conflicts: # template/src/App.vue
@Toilal I would've added this plugin already but most likely there will be more issues with specific cases (like I already had with Jest) and I would rather leave this as is for now. PS: fixed conflict, CI error looks quite strange and unrelated to the code. |
@igogrek For what it's worth, feel free to borrow any of my work from this PR: #1238 It adds TSLint support to the template, with the right configuration to have it work out of the box with VSCode. It was a bit tricky, since TSLint's |
fork-ts-checker-webpack-plugin is really better, but it involves more changes. You may have a look to http://github.com/Toilal/vue-webpack-template as it's already implemented among other options. (it's a fork and I try merge as often as possible to minimize changes from official) |
@LinusBorg |
@@ -3,7 +3,7 @@ | |||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should change the file name to main.ts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is changed via metalsmith - that was the basic idea of the PR.
See my initial comment and meta.js
I wasn't able to try this pull anymore... I got a lot of error and it doesn't ask for any option (i mean, typescript, unit test, linter, e2e...) |
@ThePlastic |
@igogrek I'm sure it is. |
@ThePlastic |
Thanks for your work on this! Unfortunately, I wasn't able to get it to work either, I've tried vue-cli@2.8.1, 2.9.3 and the current 3 version. Errors look like this:
|
@mikob I will try to update from fresh |
Just wondering what's the current status on this being merged into master? I am beginning a new project that will eventually be significant in size, I love all the features this package includes and would really like to use TypeScript within the project. |
@Patskimoto Why wouldn't you just use the latest vue-cli which has built-in TypeScript support? |
@ffxsam I have since done just that - thank you. |
This PR adds TypeScript language option to webpack template.
This is basically the same idea as in: #781
The main difference is that I've tried to find minimal possible configuration and code changes.
So in this case there's a metalsmith plugin that renames .js files from /src to .ts if typescript option is enabled.
This way there's no need to maintain both .js and .ts sources.
Checked with both TS enabled and disabled.