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: improve types for props when using Client-side component API #8950

Closed

Conversation

ivanhofer
Copy link
Contributor

@ivanhofer ivanhofer commented Jul 10, 2023

fix for sveltejs/language-tools#1578

In theory this is a breaking change. So maybe it needs to wait for version 5 of Svelte.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

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

Yeah that probably counts as a breaking change - also since #8872 I'm kinda nervous to use never as an explicit descriptor to define "this component does not accept props". null is probably better for this.

@ivanhofer
Copy link
Contributor Author

Ah, didn't knew about this issue. I updated it to use null instead.

@@ -0,0 +1,5 @@
---
'svelte': major
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be minor, unless its for svelte 5? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just updated it because it is a breaking change ^^. So it belongs to version 5, right?

Copy link
Member

Choose a reason for hiding this comment

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

That's correct. Marking this as draft so it's not accidentally merged early.

@dummdidumm dummdidumm marked this pull request as draft July 10, 2023 15:30
@benmccann
Copy link
Member

The types are more restrictive, but you wouldn't have been able to pass something that doesn't conform to these types without the code at least breaking at runtime I think? So maybe it's not really a breaking change?

@dummdidumm
Copy link
Member

The new mount function in Svelte 5 has the according typings to make the props field required when there are required props.

@dummdidumm dummdidumm closed this Dec 4, 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

Successfully merging this pull request may close these issues.

4 participants