fix: form-associated base classes need stubs for mixin classes with private/protected members #5061
Labels
area:fast-foundation
Pertains to fast-foundation
closed:obsolete
No longer valid
improvement
A non-feature-adding improvement
status:needs-investigation
Needs additional investigation
🐛 Bug Report
Any form-associated components that use the
FormAssociated()
mixin function require the use of a stub class and interface for TypeScript to properly handle private/protected members.💻 Repro or Code Sample
Ideally, we'd be able to create these stubs for form-associated components:
😯 Current Behavior
TS throws errors on the properties in
FoundationElement
which are private or protected:💁 Solution
The workaround for this bug requires creating an empty base class which extends
FoundationElement
(or the base component class, ex.Listbox
) and its interface which extendsFormAssociated
. This class should be passed to theFormAssociated()
function. Theproxy
property should then be defined in the class body instead of in the stub class.🔦 Context
microsoft/TypeScript#30355
microsoft/TypeScript#36060
microsoft/TypeScript#17744 (comment)
The text was updated successfully, but these errors were encountered: