Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types don't include Blocks or Element #1585

Closed
ef4 opened this issue Jul 8, 2023 · 1 comment
Closed

Types don't include Blocks or Element #1585

ef4 opened this issue Jul 8, 2023 · 1 comment

Comments

@ef4
Copy link
Contributor

ef4 commented Jul 8, 2023

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.

@mkszepp
Copy link
Collaborator

mkszepp commented Jan 8, 2024

@ef4 this should be fixed with next version. While update the addon to v2 we have added missing properties and with latest 2 PR we have fixed the rest.
I know that there are a lot of "any" in interface, maybe we can fix that in the future step by step

@mkszepp mkszepp closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants