Skip to content

Conversation

@Andarist
Copy link
Contributor

fixes #55907

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 29, 2023
if (isConstantVariable(symbol)) {
const declaration = symbol.valueDeclaration as VariableDeclaration | undefined;
if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
if (declaration?.kind === SyntaxKind.VariableDeclaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

alternatively, I could check if the parent is not a BindingElement

Copy link
Member

Choose a reason for hiding this comment

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

Would that break on parameters? I guess not, since isConstantVariable won't be true.

Copy link
Member

Choose a reason for hiding this comment

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

I'll also note that this feels weird because declaration is VariableDeclaration which must have kind === SyntaxKind.VariableDeclaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll also note that this feels weird because declaration is VariableDeclaration which must have kind === SyntaxKind.VariableDeclaration.

Good catch! I didn't notice it. It is VariableDeclaration just because of the cast - so I'll make that cast more accurate in a second :)

@jakebailey
Copy link
Member

@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 8cd9111. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the regular perf test suite on this PR at 8cd9111. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 8cd9111. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 29, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 8cd9111. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/55910/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 2 instances of "Package install failed"

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

@jakebailey
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,063k (± 0.02%) 295,058k (± 0.01%) ~ 295,032k 295,098k p=0.936 n=6
Parse Time 2.64s (± 1.01%) 2.63s (± 0.34%) ~ 2.62s 2.64s p=1.000 n=6
Bind Time 0.83s (± 1.47%) 0.84s (± 1.23%) ~ 0.83s 0.85s p=0.752 n=6
Check Time 8.07s (± 0.23%) 8.05s (± 0.37%) ~ 8.01s 8.09s p=0.411 n=6
Emit Time 7.04s (± 0.52%) 7.04s (± 0.46%) ~ 6.99s 7.07s p=1.000 n=6
Total Time 18.58s (± 0.24%) 18.56s (± 0.13%) ~ 18.53s 18.60s p=0.686 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,477k (± 1.34%) 191,686k (± 1.28%) ~ 190,634k 196,710k p=0.298 n=6
Parse Time 1.34s (± 1.21%) 1.34s (± 0.73%) ~ 1.32s 1.35s p=0.654 n=6
Bind Time 0.73s (± 0.00%) 0.73s (± 0.00%) ~ 0.73s 0.73s p=1.000 n=6
Check Time 9.17s (± 0.82%) 9.18s (± 0.70%) ~ 9.11s 9.28s p=0.747 n=6
Emit Time 2.63s (± 0.42%) 2.63s (± 0.46%) ~ 2.61s 2.64s p=0.739 n=6
Total Time 13.87s (± 0.60%) 13.88s (± 0.46%) ~ 13.81s 13.99s p=0.810 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,293k (± 0.01%) 347,303k (± 0.00%) ~ 347,279k 347,320k p=0.378 n=6
Parse Time 2.45s (± 0.61%) 2.47s (± 0.17%) ~ 2.46s 2.47s p=0.071 n=6
Bind Time 0.94s (± 0.00%) 0.94s (± 0.00%) ~ 0.94s 0.94s p=1.000 n=6
Check Time 6.89s (± 0.55%) 6.90s (± 0.46%) ~ 6.86s 6.94s p=0.809 n=6
Emit Time 4.02s (± 0.44%) 4.03s (± 0.34%) ~ 4.01s 4.05s p=0.192 n=6
Total Time 14.31s (± 0.34%) 14.34s (± 0.30%) ~ 14.28s 14.38s p=0.378 n=6
TFS - node (v18.15.0, x64)
Memory used 302,585k (± 0.01%) 302,556k (± 0.01%) ~ 302,525k 302,636k p=0.297 n=6
Parse Time 1.99s (± 0.32%) 2.00s (± 0.86%) ~ 1.98s 2.02s p=0.303 n=6
Bind Time 1.01s (± 0.51%) 1.00s (± 1.22%) ~ 0.99s 1.02s p=0.672 n=6
Check Time 6.27s (± 0.43%) 6.27s (± 0.39%) ~ 6.23s 6.30s p=0.871 n=6
Emit Time 3.58s (± 0.58%) 3.57s (± 0.38%) ~ 3.55s 3.59s p=0.869 n=6
Total Time 12.84s (± 0.30%) 12.85s (± 0.30%) ~ 12.80s 12.89s p=0.809 n=6
material-ui - node (v18.15.0, x64)
Memory used 470,513k (± 0.01%) 470,496k (± 0.00%) ~ 470,475k 470,541k p=0.336 n=6
Parse Time 2.57s (± 0.57%) 2.58s (± 0.32%) ~ 2.57s 2.59s p=0.284 n=6
Bind Time 0.99s (± 0.84%) 0.99s (± 1.05%) ~ 0.98s 1.01s p=1.000 n=6
Check Time 16.63s (± 0.62%) 16.65s (± 0.47%) ~ 16.55s 16.79s p=0.809 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.19s (± 0.59%) 20.21s (± 0.40%) ~ 20.10s 20.35s p=0.809 n=6
xstate - node (v18.15.0, x64)
Memory used 512,607k (± 0.01%) 512,623k (± 0.01%) ~ 512,540k 512,735k p=0.810 n=6
Parse Time 3.27s (± 0.32%) 3.27s (± 0.23%) ~ 3.26s 3.28s p=0.273 n=6
Bind Time 1.55s (± 0.00%) 1.54s (± 0.35%) ~ 1.54s 1.55s p=0.071 n=6
Check Time 2.83s (± 0.35%) 2.84s (± 0.53%) ~ 2.83s 2.87s p=0.122 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 7.72s (± 0.13%) 7.73s (± 0.29%) ~ 7.71s 7.76s p=0.745 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,370ms (± 0.88%) 2,385ms (± 1.41%) ~ 2,322ms 2,412ms p=0.229 n=6
Req 2 - geterr 5,341ms (± 1.53%) 5,288ms (± 0.50%) ~ 5,244ms 5,324ms p=0.471 n=6
Req 3 - references 331ms (± 1.39%) 341ms (± 6.96%) ~ 326ms 388ms p=0.629 n=6
Req 4 - navto 276ms (± 0.62%) 277ms (± 0.58%) ~ 275ms 280ms p=0.531 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 80ms (± 9.81%) 76ms (± 2.94%) ~ 74ms 80ms p=0.411 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,452ms (± 1.18%) 2,491ms (± 0.53%) +39ms (+ 1.59%) 2,473ms 2,506ms p=0.020 n=6
Req 2 - geterr 4,159ms (± 1.85%) 4,065ms (± 0.25%) ~ 4,053ms 4,081ms p=0.092 n=6
Req 3 - references 337ms (± 1.70%) 341ms (± 1.37%) ~ 335ms 347ms p=0.135 n=6
Req 4 - navto 283ms (± 0.18%) 285ms (± 0.37%) ~ 283ms 286ms p=0.051 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 80ms (± 7.32%) 83ms (± 6.68%) ~ 76ms 87ms p=0.342 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,585ms (± 0.50%) 2,594ms (± 0.83%) ~ 2,561ms 2,618ms p=0.575 n=6
Req 2 - geterr 1,722ms (± 2.14%) 1,704ms (± 2.78%) ~ 1,653ms 1,757ms p=0.336 n=6
Req 3 - references 110ms (± 7.41%) 113ms (± 7.33%) ~ 105ms 124ms p=0.366 n=6
Req 4 - navto 360ms (± 0.61%) 360ms (± 0.38%) ~ 358ms 361ms p=0.869 n=6
Req 5 - completionInfo count 2,071 (± 0.00%) 2,071 (± 0.00%) ~ 2,071 2,071 p=1.000 n=6
Req 5 - completionInfo 311ms (± 1.04%) 307ms (± 2.09%) ~ 296ms 314ms p=0.165 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 151.84ms (± 0.18%) 151.74ms (± 0.17%) -0.10ms (- 0.07%) 150.81ms 155.05ms p=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 227.49ms (± 0.16%) 227.26ms (± 0.17%) -0.22ms (- 0.10%) 225.91ms 232.83ms p=0.000 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 228.83ms (± 0.17%) 228.90ms (± 0.16%) +0.06ms (+ 0.03%) 227.36ms 232.91ms p=0.047 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 228.48ms (± 0.15%) 228.59ms (± 0.19%) +0.11ms (+ 0.05%) 226.96ms 236.70ms p=0.034 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/55910/merge:

Everything looks good!

@jakebailey jakebailey merged commit 38d09d4 into microsoft:main Sep 29, 2023
@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template string wrongly infers type from a default value used in destructuring assignment

3 participants