AUR9990
Error Message
AUR9990: Invalid @slotted usage. @slotted decorator can only be used on a field
Description
This error occurs when the @slotted decorator, used for accessing nodes projected into specific slots within a component's shadow DOM, is applied incorrectly. The decorator is designed only to be used on class properties (fields).
Cause
The direct cause is applying the @slotted decorator to something that is not a class property. Examples include:
Decorating a Method: Applying
@slottedto a method definition.Decorating a Class: Applying
@slotteddirectly to the class declaration.Decorating a Getter/Setter: Applying
@slottedto an accessor property.
The decorator's implementation checks the context where it's applied and throws this error if it's not a 'field'.
Solution
Ensure that the @slotted decorator is only applied directly to a class property declaration.
Example
Debugging Tips
Review the code where the
@slotteddecorator is used.Verify that the decorator is placed directly above a property declaration (e.g.,
headerNodes: Node[];).Ensure the decorator is not applied to methods, getters, setters, or the class itself.
Confirm that the component using
@slottedhas Shadow DOM enabled (shadowrootmode="open"or configured viashadowOptionsin the definition), as@slottedrelies on the Shadow DOM projection mechanism.
Last updated
Was this helpful?