Skip to content

Indexing string out of bounds is an empty string instead of undefined #890

@ark120202

Description

@ark120202

Playground

Input:

print(typeof ""[0]);

Current Result:

print(
    __TS__TypeOf(
        string.sub("", 1, 1)
    )
)

Expected Result:

function __TS__StringIndex(self, index)
	if index <= #self then
		return string.sub("", index, index)
	end
end

print(
    __TS__TypeOf(
        __TS__StringIndex("", 1)
    )
)

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