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: enable compilerOptions.strict for all packages #1433

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

AudunWA
Copy link
Contributor

@AudunWA AudunWA commented May 28, 2023

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you written unit tests?
  • Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
  • This PR is associated with an existing issue?

Closing issues
Fixes parts of #1165 ("Strict tsconfig in all packages" checkbox)

Own comments

This adds strict: true to all tsconfig.json files, and removes redundant options that strict enables.
All resulting TS errors have been fixed, but some fixes might still hide already existing issues.
Note: I kept noImplicitAny: false for tests, but I can remove it if we want full strictness for test code as well.

@AudunWA AudunWA marked this pull request as ready for review May 28, 2023 16:27
Copy link
Collaborator

@WoH WoH left a comment

Choose a reason for hiding this comment

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

Minor suggestions, looks great overall

});
}
});

return extensions;
}

function validateExtensionKey(key: string) {
if (key.indexOf('x-') !== 0) {
function validateExtensionKey(key: string): key is `x-${string}` {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer

asserts key is `x-${string}`

This is more intuitive when throwing and avoids the throwing if/then/else.

Also gives rise to renaming this function to assertValidExtensionKey

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, didn't know about that TS feature – it definitely looks better!

packages/cli/src/swagger/specGenerator3.ts Show resolved Hide resolved
@WoH WoH merged commit 6380e48 into lukeautry:master Jun 6, 2023
18 checks passed
@AudunWA AudunWA deleted the awa/fix/strict-ts branch June 6, 2023 12:41
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.

None yet

2 participants