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

Fix type guards for assert.{truthy,falsy,nan} #187

Merged
merged 3 commits into from
Jul 16, 2023

Conversation

wdzeng
Copy link
Contributor

@wdzeng wdzeng commented Jul 16, 2023

Fix that type guards for assert.truthy and assert.falsy are not working since they are declared to be unknown type.

Also change type guard for assert.nan from unknown type to number type, as NaN is actually of type number.

Closes #186

wdzeng added 3 commits July 15, 2023 19:33
Fix that type guards for `assert.truthy` and `assert.falsy` are not
working since they are declared to be `unknown` type.

Also change type guard for `assert.nan` from `unknown` type to `number`
type, as `NaN` is actually of type `number`.
This also align the generic and parameter type of `is.falsy` with
`assert.falsy`.
Add statements in test/test.ts and tests that if typescript compiler can
compile the file to check if type guard and narrowing are working as expected.
source/index.ts Outdated Show resolved Hide resolved
@wdzeng wdzeng force-pushed the main branch 4 times, most recently from eed18f1 to 18cd149 Compare July 16, 2023 13:07
@sindresorhus sindresorhus merged commit 9d26c02 into sindresorhus:main Jul 16, 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.

Some type guards under assert are not working
2 participants