Skip to content

Implicit true argument when creating a new object without parentheses #1393

@Cheatoid

Description

@Cheatoid

See this Playground example.

class C {
    constructor(baz?: unknown) {
        print(`ctor: ${baz}`);
    }
}
const foo = new C;
const bar = new C();

If you look at the last two lines of transpiled Lua code:

foo = __TS__New(C, true)
bar = __TS__New(C)

We see foo has an additional argument true passed to the constructor.
I feel like this is a bug.

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