Skip to content

Issue with immediately executed functions #1289

Description

@DuncanUszkay1

Unless I'm missing something here, seems like inlining the creation of a function and calling it in this manner seems to be broken:

Here's a minimal example:

letnormalFunc=(): (x:i32)=>i32=>{letmyFunc=(x: i32): i32=>{return24+x;}returnmyFunc;}assert(normalFunc()(1)==25);

Compiler Error:

ERROR TS2349: Cannotinvokeanexpressionwhosetypelacksacallsignature.Type'closure-common-js-patterns/normalFunc'hasnocompatiblecallsignatures.assert(normalFunc()(1)==25);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions