Skip to content

Table with generic type breaks if instantiated explicitly #2278

@sporblord

Description

@sporblord

From what I tested, it seems like it's specifically breaking if the method contains a callback in any form. If I change the type of add_callback to something like (T) -> (), it works fine.

export type Object<T> = {
	add_callback: ((instance: Instance) -> T) -> ()
}

local function new<T>(): Object<T>
	return {} :: any
end

local obj1 = new<<string>>() -- *error-type*
local obj2 = new() :: Object<string> -- typed properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions