Skip to content

Cannot invoke an expression whose type lacks a call signature (on function union) #19480

@unional

Description

@unional

tsc@2.5.3

// from lodash
declare function isFunction(func): func is ((...args: any[]) => any) | Function

if (isFunction(x)) {
  x('a') // TS2349
}

If I remove the union, it works:

declare function isFunction(func): func is ((...args: any[]) => any)

if (isFunction(x)) {
  x('a') // TS2349
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions