Skip to content

'this' parameter not stripped from function declarations #281

@tomblind

Description

@tomblind

TS allows you to explicitly type 'this' in function declarations, but it's just a typing hint that should be stripped on compilation. Currently, it is still added to the output declaration:

class Foo {
    public method(this: Foo, s: string): string { return "foo" + s; }
}

=>

Foo = Foo or {}
Foo.__index = Foo
function Foo.new(construct, ...)
    local self = setmetatable({}, Foo)
    if construct and Foo.constructor then Foo.constructor(self, ...) end
    return self
end
function Foo.constructor(self)
end
function Foo.method(self,this,s) --this is going to be a problem
    return "foo" .. s
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions