Skip to content

Types of FunctionalComponentOptions breaks #9372

Open
@meteorlxy

Description

@meteorlxy

Version

vue: 2.5.22

typescript: 3.2.4

Reproduction link

https://jsfiddle.net/meteorlxy/9x2ts16a/1/

Steps to reproduce

// works with vue 2.5.17
// fails with vue 2.5.18+
import Vue, { FunctionalComponentOptions } from 'vue'

const testFunctionalOptions: FunctionalComponentOptions = {
  functional: true,
}

Vue.component('Test', testFunctionalOptions)

What is expected?

No types error as in v2.5.17

What is actually happening?

error TS2345: Argument of type 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>>'.
  Types of property 'render' are incompatible.
    Type '(this: undefined, createElement: CreateElement, context: RenderContext<Record<string, any>>) => VNode | VNode[]' is not assignable to type '(createElement: CreateElement, hack: RenderContext<Record<string,
any>>) => VNode'.
      Type 'VNode | VNode[]' is not assignable to type 'VNode'.
        Type 'VNode[]' is missing the following properties from type 'VNode': isRootInsert, isComment

PS

It seems to be introduced here:

bf2e2ed#diff-23d7799dcc9e9be419d28a15348b0d99R116

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions