-
Notifications
You must be signed in to change notification settings - Fork 43
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: enable TS strict mode #889
Conversation
i don't feel great about this but progress is progress lol
this diff is kinda crazy but no actual changes here. an external contributor just did a bunch of unnecessary function nesting and TS didn't like that.
src/cmds/categories/create.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the diff on this file is a bit wild but there aren't any actual changes to the code — just some refactoring to get rid of the unnecessary nested functions because TS doesn't like those (and neither do i lol)
@@ -222,11 +223,8 @@ export default class OpenAPICommand extends Command { | |||
const options: RequestInit = { | |||
headers: cleanHeaders( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the signature of our cleanHeaders
function so the second parameter is a version
which we use to construct our x-readme-version
request header. You'll see a lot of refactors related to that in this PR.
|
||
export type ZeroAuthCommandOptions<T> = T & { | ||
github?: boolean; | ||
} & { key?: never }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split out our command options for commands that do and do not require auth so we could assert that commands with zero auth do not accept a key parameter. TS is cool sometimes
Co-Authored-By: Jon Ursenbach <[email protected]>
🎉 This PR is included in version 9.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🧰 Changes
Enables the
strict
typescript flag in this repository. Any specific callouts will be flagged in the comments below.🧬 QA & Testing
Doing this exercise likely added type safety and error handling around weird API edge cases but I'd rather write the tests and do the QA if these edge cases become a problem. There were basically no changes to our existing tests so if those pass then we should be in good shape.