Skip to content

Typings with Typescript 2.7.1 #7640

Closed
Closed
@AntoineEsteve

Description

@AntoineEsteve

Version

2.5.13

Steps to reproduce

Create a simple component using Typescript:

import Vue from "vue"

Vue.extend({
    props: {
        myProp: {
            type: Array,
        },
    },
    computed: {
        myComputed(): string {
            return "hello"
        },
        otherComputed(): string {
            return this.myComputed
        },
    },
})

We have the following error:

 TS2322: Type '(() => any) | ComputedOptions<any>' is not assignable to type 'string'.
  Type '() => any' is not assignable to type 'string'.

If we change the type of the prop to String, Number or smtg else we don't have this problem anymore

What is expected?

No error

What is actually happening?

Errors


This problem was not happening with the previous Typescript versions (at least 2.5.2)

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