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(types): improve TypeScript strict typing for numeric keys in HttpStatus #49

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

aronmal
Copy link
Contributor

@aronmal aronmal commented Feb 22, 2024

The TypeScript type inference for numeric keys in the HttpStatus interface was previously unspecific, causing issues in strict typing scenarios. This fix removes unnecessary declarations, ensuring more accurate and strict TypeScript typing for numeric keys. It also includes updates to unit tests to reflect and validate the improved strict typing.

Closes #48

test/types.ts Outdated
@@ -50,32 +41,32 @@ describe('Types', () => {
describe('ES6 exports', () => {

it('HttpStatus', () => {
const statuses: HttpStatus = status
Copy link
Member

Choose a reason for hiding this comment

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

Why are you removing the type cast to HttpStatus ? I believe we shall keep those (same question for the tests below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because they are now implicitly inferred.

Do you wish them to stay?

…Status

The TypeScript type inference for numeric keys in the HttpStatus interface was
previously unspecific, causing issues in strict typing scenarios. This fix
removes unnecessary declarations, ensuring more accurate and strict TypeScript
typing for numeric keys. It also includes updates to unit tests to reflect and
validate the improved strict typing.

Closes #48
@aronmal
Copy link
Contributor Author

aronmal commented Feb 22, 2024

Unit test now has only necessary changes.

@wdavidw wdavidw merged commit 4945afd into adaltas:master Feb 23, 2024
7 checks passed
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.

Unable to properly infer numeric keys in TypeScript type with mixed key types
2 participants