-
-
Notifications
You must be signed in to change notification settings - Fork 488
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The <script>
section of vue templates is optional and apps build fine without it, but vue-tsc
causes a type error to be thrown:
Example component:
<template lang='pug'>
app-svg(name='logo' responsive)
</template>
(noting there's no <script>
section)
app/src/components/other/AppSidebar.vue:43:2 - error TS2769: No overload matches this call.
Overload 1 of 2, '(options: ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<DefaultProps>, DefaultProps> & ThisType<...>): <VC extends VueClass<...>>(target: VC) => VC', gave the following error.
Type 'DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, PublicProps, Readonly<...> & ({ ...; } | { ...; }), {}>' is not assignable to type 'Component<any, any, any, any> | AsyncComponent<any, any, any, any>'.
Type 'ComponentPublicInstanceConstructor<{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<({} & (Readonly<{} & {} & {}> & ({ [x: string & `on${string}`]: never; } | { ...; }))) & (VNodeProps & ... 3 more ... & ({ ...; } | { ...; })), never>; ... 10 more ...; $watch(source: string | Function, cb: Funct...' is missing the following properties from type 'VueConstructor<Vue>': extend, nextTick, set, delete, and 10 more.
Overload 2 of 2, '(target: VueClass<Vue>): VueClass<Vue>', gave the following error.
Argument of type '{ components: { AppLogo: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, PublicProps, Readonly<...> & ({ ...; } | { ...; }), {}>; }; }' is not assignable to parameter of type 'VueClass<Vue>'.
Object literal may only specify known properties, but 'components' does not exist in type 'VueClass<Vue>'. Did you mean to write 'component'?
43 @Component({
~~~~~~~~~~~
44 components: {AppLogo},
~~~~~~~~~~~~~~~~~~~~~~~~~~
45 })
~~
Simply adding in <script></script>
resolves the issue. So this obviously isn't a big deal, but just thought I'd mention, especially as it took me a very long time to debug :)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working