Skip to content

Conversation

@chrskerr
Copy link
Contributor

@chrskerr chrskerr commented Jan 9, 2023

The current type for updated.check() is boolean which allows for subtle errors like the below. This will always be true since the runtime type for check() is a promise.

if (updated.check()) { // always true
   // do something
}

And the code should be:

if (await updated.check()) {
   // do something
}

Updating the types means that TS catches my mistake.

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. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2023

🦋 Changeset detected

Latest commit: dfc5e14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@vercel
Copy link

vercel bot commented Jan 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
kit 🔄 Building (Inspect) Jan 9, 2023 at 0:42AM (UTC)

@chrskerr chrskerr changed the title [fix] updated.check() type changed to promise<boolean> [fix] updated.check() type changed to Promise<boolean> Jan 9, 2023
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.

Thank you!

@dummdidumm dummdidumm merged commit e379a5d into sveltejs:master Jan 9, 2023
@github-actions github-actions bot mentioned this pull request Jan 9, 2023
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