Skip to content

Conversation

@hyunbinseo
Copy link
Contributor

Argument of type RemoteFormIssue[] | undefined is not assignable to parameter of type Iterable<unknown> | ArrayLike<unknown>.

Type undefined is not assignable to type Iterable<unknown> | ArrayLike<unknown>. ts(2345)

{#each createPost.fields.title.issues() as issue}
{/each}

{#each addId.fields.allIssues() as issue}
{/each}

Please don't delete this checklist! 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
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

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

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot
Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 664c55b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svelte-docs-bot
Copy link

@dummdidumm
Copy link
Member

dummdidumm commented Oct 7, 2025

Thank you!

While this is true, I wonder - should we instead make issues() an empty array if there are no issues? In the common case you iterate over it and if it's 0 you just show nothing. The case of const valid = !!myForm.fields.issues() which would now be const valid = myForm.fields.issues().length > 0 is less common on comparison (and we could always introduce an alias like invalid() if it turns out to be very common)

@Rich-Harris
Copy link
Member

Alternatively we could make Svelte's types match the runtime behaviour. {#each undefined as x} and {#each null as x} are both totally fine, but you get red squigglies. I'd prefer that to making issues() return a truthy value when there are no issues

@Rich-Harris
Copy link
Member

(is that a language-tools issue? where would we change that if we wanted to?)

@dummdidumm
Copy link
Member

Ah right, this changed in Svelte 5 but the types in language tools were not updated to reflect that. Will fix there.

@hyunbinseo
Copy link
Contributor Author

Since RemoteFormIssue only has a message key, could the ESLint svelte/require-each-key be disabled as well?

<!-- eslint-disable-next-line svelte/require-each-key -->
{#each addId.fields.uuid.issues() as issue}
  <p>{issue.message}</p>
{/each}

It would this cause inconsistency, but disabling this rule every single time is cumbersome and unclean.

@Rich-Harris
Copy link
Member

So don't enable it in the first place? Not sure what you're asking

@dummdidumm
Copy link
Member

dummdidumm commented Oct 8, 2025

closing in favor of sveltejs/language-tools#2863

@dummdidumm dummdidumm closed this Oct 8, 2025
@hyunbinseo hyunbinseo deleted the patch-2 branch October 8, 2025 14:07
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.

3 participants