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: negative number #4

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

maximebiloe
Copy link

On our project we wanted to migrate to Typescript 5.4 but we encountered the following issue

Error: Debug Failure. False expression: Negative numbers should be created in combination with createPrefixUnaryExpression
    at Object.createNumericLiteral (node_modules/typescript/lib/typescript.js:21097:13)
    at Object.buildNumericLiteralTypeNode (node_modules/@anttiviljami/dtsgenerator/dist/core/astBuilder.js:56:56)
    at DtsGenerator.generateLiteralTypeNode (node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:312:28)
    at node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:279:29
    at Array.map (<anonymous>)
    at Object.buildUnionTypeNode (node_modules/@anttiviljami/dtsgenerator/dist/core/astBuilder.js:124:55)
    at DtsGenerator.generateLiteralTypeProperty (node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:278:24)
    at DtsGenerator.generateTypeProperty (node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:273:21)
    at DtsGenerator.generateProperties (node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:244:84)
    at DtsGenerator.generateDeclareType (node_modules/@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js:218:34)

So here is a PR to fix it.
To do it, I've locally bumped the Typescript version used to 5.4.5, created the test case and fixed the issue to use the right method.
I didn't want to upgrade the Typescript version in your package.json as I didn't know if you want to run further tests to declare your package compatible. If you want me to do it, let me know and I'll push an extra commit

This is a backport of my PR done on the original repository and already released

@greeeg
Copy link

greeeg commented Jun 11, 2024

Awesome, thanks @maximebiloe 🚀

@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9461529382

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 89.587%

Totals Coverage Status
Change from base Build 7677698900: 0.03%
Covered Lines: 1123
Relevant Lines: 1233

💛 - Coveralls

2 similar comments
@coveralls
Copy link

Pull Request Test Coverage Report for Build 9461529382

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 89.587%

Totals Coverage Status
Change from base Build 7677698900: 0.03%
Covered Lines: 1123
Relevant Lines: 1233

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9461529382

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 89.587%

Totals Coverage Status
Change from base Build 7677698900: 0.03%
Covered Lines: 1123
Relevant Lines: 1233

💛 - Coveralls

@anttiviljami anttiviljami merged commit 3bb8237 into anttiviljami:master Jun 12, 2024
3 of 4 checks passed
@maximebiloe maximebiloe deleted the fix-negative-number-2 branch June 12, 2024 09:19
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.

4 participants