Fix missing export Fields type for Icon#212
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the public Luau type surface for Icon so that instance properties/events (e.g. isEnabled, selected, toggled) are available to typed consumers.
Changes:
- Extend
export type Iconto includeFields(properties + signals) in its intersection type.
Comments suppressed due to low confidence (1)
src/Types.lua:464
Methodsis already defined as an intersection withStaticFunctions(type Methods = {...} & StaticFunctions), soexport type Icon = Methods & Fields & StaticFunctionsredundantly intersectsStaticFunctionstwice. Consider removing the extra& StaticFunctionshere (or removing it fromMethods) to keep the type composition easier to understand.
export type Icon = Methods & Fields & StaticFunctions --typeof(setmetatable({} :: Fields, MT))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| export type Icon = Methods & StaticFunctions --typeof(setmetatable({} :: Fields, MT)) | ||
| export type Icon = Methods & Fields & StaticFunctions --typeof(setmetatable({} :: Fields, MT)) |
There was a problem hiding this comment.
Now that Icon includes Fields, the event/property types in Fields become part of the public API. Several Signal generics in Fields don’t match how the library fires these events at runtime (e.g. toggled is fired with (boolean, fromSource, sourceIcon); selected/deselected are fired with (fromSource, sourceIcon); viewingStarted/viewingEnded are fired with a boolean; notified is fired with a noticeId). Please update the Fields signal type parameters to reflect the actual :Fire(...) signatures so typed consumers can receive the correct arguments.
|
Side note, but this PR is a bit iffy since I don't know well how the types work for TopbarPlus and whether they are 100% correct to begin with. This PR assumes the types are 100% correct to begin with. |
Fixes the
Icontype, which is missing properties and events such asisEnabledandselected.Reproduction:
Closes #214
Before
After