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

fix: fix #432 to support signals #433

Closed
wants to merge 1 commit into from
Closed

Conversation

motss
Copy link

@motss motss commented Oct 15, 2022

Problem

TypeScript compiler complains on the type conflict after signal support in Preact's type.

See #432 for more details.

Solution

  1. Extend RoutableProps by picking native HTML default attribute

Copy link
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long-time-no-look, but this change causes a few immediately noticeable issues too:

  1. HTMLAttributes<HTMLElement> seemingly doesn't accept children, so even something like the following is a no-go:
<header>
    <p>Hello World!</p>
</header>
  1. ref isn't a valid HTML attribute, so that causes issues too.

I don't know what the correct solution is myself, however. We're looking at this over at preactjs/preact#3934

@@ -17,9 +17,8 @@ export interface CustomHistory {
replace(path: string): void;
}

export interface RoutableProps {
export interface RoutableProps extends Pick<HTMLAttributes<HTMLElement>, 'default'> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export interface RoutableProps extends Pick<HTMLAttributes<HTMLElement>, 'default'> {
export interface RoutableProps extends Pick<preact.JSX.HTMLAttributes<HTMLElement>, 'default'> {

@rschristian
Copy link
Member

Superseded by #452

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

Successfully merging this pull request may close these issues.

2 participants