fix: omit unnecessary nullish coallescing in template expressions#15056
fix: omit unnecessary nullish coallescing in template expressions#15056paoloricciuti merged 2 commits intosveltejs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: e58a65a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
preview: https://svelte-dev-git-preview-svelte-15056-svelte.vercel.app/ this is an automated message |
|
|
Can you also add a test for this? |
Which section of the test folder should I put it in? None of them seem to really match this PR. (Apologies for not responding until now, in my timezone you sent that message at 2 am 😅) |
You can probably put something in |
|
Thanks! |
Currently, Svelte will almost always append a nullish coallescence statement (
maybeNullish ?? alternate) to any interpolations in a template expression, regardless of whether there already is one. This changes that, so that nullish coallescence to a non-null literal will stay the same, and instuff ?? nullcases,nullis replaced with an empty string.Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint