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

chore: enables multiple new tsconfig safety flags #431

Merged
merged 3 commits into from
Dec 24, 2024

Conversation

hugop95
Copy link
Contributor

@hugop95 hugop95 commented Dec 24, 2024

Description

Typescript documentation: https://www.typescriptlang.org/tsconfig.

This PR enables the following flags in tsconfig.json to strengthen type-safety in the project.

  • noUnusedLocals: true (no code impacted)
  • noUnusedParameters: true (no code impacted)
  • noImplicitReturns: true (no code impacted)
  • allowUnreachableCode: false (no code impacted)
  • noUncheckedIndexedAccess: true (code impacted here: 454fe7b)
  • noPropertyAccessFromIndexSignature: true (code impacted here: ff9563d)

Additional interesting flags not added in this PR:
exactOptionalPropertyTypes

What is the purpose of this pull request?

  • Other

@hugop95 hugop95 marked this pull request as ready for review December 24, 2024 01:01
@azat-io
Copy link
Owner

azat-io commented Dec 24, 2024

I don't really understand the benefit of the noPropertyAccessFromIndexSignature option yet. I'll look into it.

Also your PR commit type should be renamed from "feat" to "chore" or "refactor". Because "feat", "fix" and "perf" are automatically included in changelog, which is not the information users need.

@hugop95 hugop95 changed the title feat: enables multiple new tsconfig safety flags chore: enables multiple new tsconfig safety flags Dec 24, 2024
@hugop95 hugop95 force-pushed the feat/noUncheckedIndexedAccess branch from 0cbab22 to a4f3a6d Compare December 24, 2024 18:11
@hugop95
Copy link
Contributor Author

hugop95 commented Dec 24, 2024

@azat-io

Also your PR commit type should be renamed from "feat" to "chore" or "refactor"

Oops, forgot about it, renamed.

I don't really understand the benefit of the noPropertyAccessFromIndexSignature option yet. I'll look into it.

https://www.typescriptlang.org/tsconfig/#noPropertyAccessFromIndexSignature

"The goal of this flag is to signal intent in your calling syntax about how certain you are this property exists."

@azat-io azat-io merged commit c9f74b0 into azat-io:main Dec 24, 2024
8 checks passed
@azat-io
Copy link
Owner

azat-io commented Dec 24, 2024

Thanks!

@hugop95 hugop95 deleted the feat/noUncheckedIndexedAccess branch December 24, 2024 18:39
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.

2 participants