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

refactor: turn on strict mode in Typescript configuration #262

Merged
merged 49 commits into from
Sep 14, 2020

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Sep 2, 2020

Problem

Turn on strict mode that allows the Typescript compiler to alert us on undefined or nullable errors.

Various changes are made in the codebase to accommodate this change.

Also add better JSDocs on the functions I've come across

Closes #163

Features

  • add vendor typings for convict-format-with-validator in types/vendors
  • add vendor typing for express-device package in types/vendors
  • add vendor typing for bson-ext package in types/vendors

Improvements

  • Correct all errors that arise from the change to strict mode

Dev Dependencies

  • bump ts-jest from 26.1.4 to 26.3.0: This removes the Typescript unsupported warning
  • bump @shelf/jest-mongodb from 1.2.2 to 1.2.3: I thought this would allow us to not have to manually setup and teardown on dbHandler.connect, but that does not seem to be the case. No harm updating though so it stays.

@karrui
Copy link
Contributor Author

karrui commented Sep 2, 2020

The number of lines is a lie again, most of it is due to adding vendor typings to packages without types!!

@karrui
Copy link
Contributor Author

karrui commented Sep 2, 2020

I have absolutely no clue why testcafe fails to start....

YAYYYYYYYYYYYYY TESTS PASS

Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this across the finish line; in retrospect strict mode probably should have been enabled at the start. I see plenty of non-null assertions being made, but I'll take what I can get.

@karrui
Copy link
Contributor Author

karrui commented Sep 7, 2020

Thanks for getting this across the finish line; in retrospect strict mode probably should have been enabled at the start. I see plenty of non-null assertions being made, but I'll take what I can get.

I added lint rules for non null too, they are now warnings so it should get devs to be more aware too

@liangyuanruo liangyuanruo force-pushed the feat/turn-on-ts-strict branch from f1ebdb6 to 467024c Compare September 9, 2020 02:54
@mantariksh
Copy link
Contributor

I'm working on fixing these merge conflicts, will merge once I'm done

karrui and others added 23 commits September 14, 2020 12:51
This adds on to commit 60ba0e3d1a9dd5c293fcd9434aebb7d04a3ffcaf.
This removes the Typescript unsupported warning
Error should only be thrown if state is undefined
@mantariksh mantariksh force-pushed the feat/turn-on-ts-strict branch from 467024c to afe1732 Compare September 14, 2020 05:37
@mantariksh mantariksh merged commit 6f8892e into develop Sep 14, 2020
@karrui karrui deleted the feat/turn-on-ts-strict branch September 24, 2020 07:36
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.

Turn on strictNullChecks in tsconfig.json
3 participants