Skip to content

fix: adds support for assertion functions #25

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

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

renato-bohler
Copy link
Contributor

@renato-bohler renato-bohler commented Jan 21, 2024

Description (What)

This PR adds support for assertion functions. Assertion functions are not available as arrow functions (see microsoft/TypeScript#34523).

Fixes #22

Justification (Why)

Because we're not supposed to be converting assertion functions to arrow functions.

How Can This Be Tested?

  1. Checkout this branch
  2. Install dependencies
  3. Run yarn test
  4. The new entry in alwaysValid (function foo(val: any): asserts val is string {}) should pass on the test

@JamieMason
Copy link
Owner

Thanks, assertion functions did not exist when I wrote this. Will pick this up when I can 👍

@renato-bohler
Copy link
Contributor Author

Hey, thanks for the quick response. Love the plugin by the way!

@renato-bohler
Copy link
Contributor Author

I validated this change against a fairly big codebase, and everything worked as expected.

@JamieMason JamieMason merged commit 4afdec8 into JamieMason:main Feb 25, 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.

Shouldn't flag/auto-fix "assertion" functions
2 participants