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

test: clean up typecast through type assertions #1484

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

arthurschreiber
Copy link
Collaborator

@arthurschreiber arthurschreiber commented Oct 24, 2022

This removes the @types/chai package and instead places a copy of the type definitions to types/chai.d.ts.

I made a few changes to the type definitions for chai and opened a pull request over at DefinitelyTyped/DefinitelyTyped#60464. Unfortunately, the changes haven't been merged yet, and I didn't have time to fix up the PR.

To clean up the tests in tedious, I decided that it'll be easier to vendor the type definitions for chai for the time being, and then re-open that pull request at some later time.

One of the changes I made to the chai definitions is to change assert.instanceOf to perform a type assertion. This helps TypeScript's understanding of what types a variable can have after the call to the assertion method. A similar change was also done to assert.exists.

@arthurschreiber arthurschreiber changed the title Clean up test typecasts refactor: clean up test typecasts Oct 24, 2022
@arthurschreiber arthurschreiber changed the title refactor: clean up test typecasts test: clean up typecast through type assertions Oct 24, 2022
@codecov
Copy link

codecov bot commented Oct 24, 2022

Codecov Report

Merging #1484 (c7e3e36) into master (ece396a) will decrease coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1484      +/-   ##
==========================================
- Coverage   80.48%   80.45%   -0.03%     
==========================================
  Files          91       91              
  Lines        4657     4657              
  Branches      856      856              
==========================================
- Hits         3748     3747       -1     
- Misses        633      634       +1     
  Partials      276      276              
Impacted Files Coverage Δ
src/connection.ts 65.14% <0.00%> (-0.10%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@arthurschreiber arthurschreiber force-pushed the arthur/improve-test-typechecks branch from aec4b5c to 1103c79 Compare October 24, 2022 22:57
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.

1 participant