Skip to content

Code is too complex to type check error is too eager with class prototypes in new solver #2056

@gaymeowing

Description

@gaymeowing
type BaseButtonPrototype = {
	set_active: (plugin_button: { read button: PluginToolbarButton }, active: boolean) -> (),
	__index: BaseButtonPrototype
}

type PluginActionButtonPrototype = BaseButtonPrototype & {
	on_trigger: (plugin_action_button: PluginActionButton, f: () -> ()) -> (() -> ()),
 	__index: PluginActionButtonPrototype,
}

export type PluginActionButton = typeof(setmetatable({} :: {
	read button: PluginToolbarButton,
	read action: PluginAction,
	enabled: boolean,
-- type error occurs when the cast happens {} :: PluginActionButtonPrototype
-- the type error wont occur if __index is removed from BaseButtonPrototype
-- TypeError: Code is too complex to typecheck! Consider simplifying the code around this area Luau (1035)
}, {} :: PluginActionButtonPrototype))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew solverThis issue is specific to the new solver.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions