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

Use type alias instead of interface #2027

Draft
wants to merge 2 commits into
base: ci-test-src-types
Choose a base branch
from

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Oct 25, 2024

This resolves the TypeScript errors for the generated types, but now causes issues for consumption.

This is because certain attributes that exist on RestProps do not overlap, resulting in Error: Type <X> is not assignable to type 'never'. (ts).

The overlapping custom props would need to be omitted from RestProps, e.g., Omit<RestProps, "size">.

@metonym
Copy link
Collaborator Author

metonym commented Oct 26, 2024

Needs something like:

type RestProps = SvelteHTMLElements["input"];

type ComponentProps = { /** ... */ };

export type SearchProps = Omit<RestProps, keyof ComponentProps> & ComponentProps;

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.

1 participant