If you’re curious about this, you can try it out by cloning the Playground project (making sure to check out the new-types branch) and opening it with VSCode + Vetur!
Actions that TypeScript users might need
The TypeScript upgrade will officially be available in Vue 2.5, currently scheduled for release in early October. We are releasing a small version because there are no groundbreaking changes to the JavaScript public API, but the upgrade may require some action by existing TypeScript + Vue users. That’s why we’re announcing the change now so you have enough time to plan the upgrade.
- New Typings should be at least TypeScript version 2.4. Upgrading to the latest version of TypeScript and Vue 2.5 is recommended.
- Tsconfig. Previously, we have recommended in json every place using ES style of imports (import Vue from ‘Vue) and “allowSyntheticDefaultImports” : true. The new Typings will formally convert to the ES style import/export syntax, so configuration is no longer required and users will need to use ES style import in all cases.
- With the export syntax change, the following core libraries that rely on Vue core typing will receive the new major version and should be upgraded with Vue Core 2.5: Vuex, vue-router, vuex-router-sync, vuE-class-component.
- When performing custom module extensions, users should now use Interface VueConstructor instead of Namespace Vue. (Example diff)
- If you annotate your component as ComponentOptions
, computed, Watch, Render and thisType of lifecycle hooks will need to be entered manually
We tried to minimize the amount of work needed to upgrade, and these types of improvements are compatible with the class-based apis in vue-class-Component. For most users, simply upgrade the dependencies and switch to ES style imports. We also recommend not upgrading unless you’re ready.
Roadmap: VUe-typescript support in CLI
After 2.5, we plan to introduce official support for TypeScript in the next release of VUE-CLI to make it easier for TS + Vue users to launch new projects. Stay tuned!
For non-typescript users
These changes do not affect non-typescript Vue users in any negative way; 2.5 will be fully backward compatible according to the common JavaScript API, and TypeScript CLI integration will be entirely optional. But as mentioned above, if you use the vue-language-server-driven editor plug-in, you may notice better auto-complete prompts.
–
Thanks to Daniel Rosenwasser, HerringtonDarkholme, Katashin and Pine Wu for working on these features and reviewing this article.
via medium.com