vue-cli
vue-cli copied to clipboard
HelloWorld (with TypeScript) type errors
Version
4.5.4
Reproduction link
https://github.com/syphzur/vue-ts-issue - project generated by vue cli
Environment info
System:
OS: Windows 10 10.0.18363
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Binaries:
Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 84.0.4147.135
Edge: Spartan (44.18362.449.0)
npmPackages:
@vue/cli-overlay: 4.5.4
@vue/cli-plugin-eslint: ~4.5.0 => 4.5.4
@vue/cli-plugin-router: ~4.5.0 => 4.5.4
@vue/cli-plugin-typescript: ~4.5.0 => 4.5.4
@vue/cli-plugin-vuex: 4.5.4
@vue/cli-service: ~4.5.0 => 4.5.4
@vue/cli-shared-utils: 4.5.4
@vue/compiler-core: 3.0.0-rc.7
@vue/compiler-dom: 3.0.0-rc.7
@vue/compiler-sfc: ^3.0.0-0 => 3.0.0-rc.7
@vue/compiler-ssr: 3.0.0-rc.7
@vue/component-compiler-utils: 3.2.0
@vue/eslint-config-prettier: ^6.0.0 => 6.0.0
@vue/eslint-config-typescript: ^5.0.2 => 5.0.2
@vue/preload-webpack-plugin: 1.1.2
@vue/reactivity: 3.0.0-rc.7
@vue/runtime-core: 3.0.0-rc.7
@vue/runtime-dom: 3.0.0-rc.7
@vue/shared: 3.0.0-rc.7
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^7.0.0-0 => 7.0.0-beta.2
typescript: ~3.9.3 => 3.9.7
vue: ^3.0.0-0 => 3.0.0-rc.7
vue-class-component: ^8.0.0-0 => 8.0.0-alpha.6
vue-eslint-parser: 7.1.0
vue-hot-reload-api: 2.3.4
vue-loader: 15.9.3 (16.0.0-beta.5)
vue-router: ^4.0.0-0 => 4.0.0-beta.7
vue-style-loader: 4.1.2
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
npm run serve
What is expected?
DONE Compiled successfully in 1324ms 5:24:51 PM
App running at:
- Local: http://localhost:8080/
- Network: http://192.168.0.198:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
What is actually happening?
Issues checking in progress...
ERROR in src/router/index.ts:8:5
TS2322: Type 'typeof Home' is not assignable to type 'undefined'.
6 | path: "/",
7 | name: "Home",
> 8 | component: Home
| ^^^^^^^^^
9 | },
10 | {
11 | path: "/about",
ERROR in src/views/Home.vue:14:5
TS2322: Type 'typeof HelloWorld' is not assignable to type 'Component'.
Type 'typeof HelloWorld' is not assignable to type 'ComponentPublicInstanceConstructor<any>'.
12 | @Options({
13 | components: {
> 14 | HelloWorld
| ^^^^^^^^^^
15 | }
16 | })
17 | export default class Home extends Vue {}
HelloWorld component generated by @vue/cli 4.5.4 is not compiling due to type error.
It happens when user choose class-style component syntax.
Fixed in rc.8