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 @ts-expect-error over @ts-ignore #1999

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

utkarshkukreti
Copy link
Contributor

@utkarshkukreti utkarshkukreti commented Jul 23, 2021

Rationale: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#ts-ignore-or-ts-expect-error

Pick ts-expect-error if:

  • you’re writing test code where you actually want the type system to error on an operation
  • you expect a fix to be coming in fairly quickly and you just need a quick workaround
  • you’re in a reasonably-sized project with a proactive team that wants to remove suppression comments as soon affected code is valid again

There were a few unnecessary @ts-ignore which this change pointed out (which is why the diff has more removals than insertions).

cc @benmccann, #1998

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 pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Rationale: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#ts-ignore-or-ts-expect-error

There were a few unnecessary @ts-ignore which this change pointed out
(which is why the diff has more removals than insertions).
@changeset-bot
Copy link

changeset-bot bot commented Jul 23, 2021

⚠️ No Changeset found

Latest commit: 5caa2c4

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

@benmccann
Copy link
Member

Thanks! I see there's still another 30 @ts-ignore comments (grep -r ts-ignore packages/kit/src/). Should we switch them all over?

@utkarshkukreti
Copy link
Contributor Author

grep -r ts-ignore packages/kit/src/ prints nothing for me and neither does git grep ts-ignore. Maybe grep is looking into some build artifacts present on your system?

@benmccann
Copy link
Member

Ooops. I was on the wrong branch 😄

@benmccann benmccann merged commit c554269 into sveltejs:master Jul 23, 2021
sidharthv96 added a commit to sidharthv96/kit that referenced this pull request Jul 31, 2021
…ePath

* 'master' of https://github.com/sveltejs/kit: (85 commits)
  [chore] minor simplification of `parse_body` (sveltejs#2043)
  Version Packages (next) (sveltejs#2026)
  [chore] deduplicate config types (sveltejs#2030)
  [chore] remove invalid css declaration (sveltejs#2038)
  [fix] correctly pass Vite options in preview mode (sveltejs#2036)
  [feat] Ignore adapter build files (sveltejs#1924)
  [chore] Upgrade Rollup
  Don't check external links on prerender (sveltejs#1679)
  Version Packages (next) (sveltejs#2017)
  [chore] convert remaining type aliases (sveltejs#2018)
  [feat] explicitly set compilerOptions.hydratable to config.kit.hydrate (sveltejs#2024)
  [feat] More powerful and configurable rendering options (sveltejs#2008)
  [chore] typecheck example (sveltejs#2019)
  Change config `prerender.force` to `prerender.onError` (sveltejs#2007)
  [chore] prefer interfaces to types (sveltejs#2010)
  [docs] minor wording improvement in migration guide (sveltejs#2006)
  [chore] test debugging improvements
  [docs] fix typo (sveltejs#2003)
  [chore] use @ts-expect-error instead of @ts-ignore (sveltejs#1999)
  Version Packages (next) (sveltejs#1996)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants