Skip to content

期望大佬升级typescript #20

@septbr

Description

@septbr
class X {
    public go(data: { arg1: number }) { }
}
class Y {
    public x?: { call: () => void } = { call: () => console.log('x?.call();') }
    public go(data: { arg1: number, arg2?: string }) { }
}
let x = new X(), y = new Y();

// error TS2349: Cannot invoke an expression whose type lacks a call signature.
// Type '((data: { arg1: number; }) => void) | ((data: { arg1: number; arg2?: string; }) => void)' has no compatible call signatures.
let go: typeof x.go | typeof y.go = x.go;
go({ arg1: 0 });

// error: Optional Chaining in typescript 3.7.x
y?.x.call();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions