-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Cover more literal expressions in getQuickTypeOfExpression
#52181
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
Cover more literal expressions in getQuickTypeOfExpression
#52181
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
node.kind === SyntaxKind.TrueKeyword || node.kind === SyntaxKind.FalseKeyword) { | ||
else if (isLiteralExpression(node) || isBooleanLiteral(node)) { | ||
return checkExpression(node); |
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.
Note that the test suite passes even if we remove this else if
block entirely - leading me to believe that this is merely an optimization for those types here (as it's not an unused code
The main improvement here is to just cover every literal type - including bigints, regexps and "no substitution template literals".
Feel free to close the PR if you don't like this change.
@typescript-bot perf test this |
Heya @andrewbranch, I've started to run the perf test suite on this PR at 2c65347. You can monitor the build here. Update: The results are in! |
@andrewbranch Here they are:
CompilerComparison Report - main..52181
System
Hosts
Scenarios
TSServerComparison Report - main..52181
System
Hosts
Scenarios
StartupComparison Report - main..52181
System
Hosts
Scenarios
Developer Information: |
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.
This seems fine, though it looks like it probably doesn’t improve performance for programs that aren’t just hundreds of thousands of lines of await
ing bigint literals 😛
It's just a thing that I noticed when working on different things.