Skip to content

Headers being appended to all lib functions, regardless of noHeader flag #610

@tomblind

Description

@tomblind
declare const arr: number[];
arr.push(1);
arr.unshift(2);

=>

-- Lua Library inline imports
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
function __TS__ArrayPush(arr, ...)
    local items = ({...})
    for ____, item in ipairs(items) do
        arr[#arr + 1] = item
    end
    return #arr
end

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
function __TS__ArrayUnshift(arr, ...)
    local items = ({...})
    do
        local i = #items - 1
        while i >= 0 do
            table.insert(arr, 1, items[i + 1])
            i = i - 1
        end
    end
    return #arr
end

__TS__ArrayPush(arr, 1)
__TS__ArrayUnshift(arr, 2)

Built with:

> tstl main.ts --noHeader

or with tsconfig containing:

{
    tstl: {
        "noHeader": true
    }
}

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