Types don't include Blocks or Element
ef4 opened this issue · 1 comments
ef4 commented
As of RFC 748 components can declare the blocks they accept and the element they expose, if any.
People who are typechecking their templates will get type errors if they try to use power select and it doesn't declare these things, since power select does need to accept a block (and can accept html attributes).
A minimal version of this change would look something like:
-export default class PowerSelect extends Component<PowerSelectArgs> {
+export default class PowerSelect extends Component<{ Args: PowerSelectArgs, Blocks: { default: [any] }, Element: HTMLElement }> {
The any
isn't ideal, but it's consistent with how the existing PowerSelectArgs are defined (which is that the user's model type is any
). A larger change that would address that would make the whole component generic over the type of the user's model, so that @options
is a T[]
, @selected
is a T
, the default block yields a T
, and so on.