GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't skip markLinkedReferences on ambient properties by jakebailey · Pull Request #59325 · microsoft/TypeScript

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member

Fixes #59051

Alternatively, I can also only walk ambients when emitDecoratorMetadata is on, or only when the hint is Unspecified or Decorator.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zanminkian, ExE-Boss, and Max10240 reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
Jake Bailey (jakebailey) added 2 commits July 17, 2024 10:10
@jakebailey
Add test
0fd3b42
@jakebailey
Don't skip markLinkedReferences on ambients
fdf4432
@jakebailey
Jake Bailey (jakebailey) requested review from Andrew Branch (andrewbranch), Ron Buckton (rbuckton) and Wesley Wigham (weswigham) July 17, 2024 17:20
@jakebailey

Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

typescript-bot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot TypeScript Bot (typescript-bot) assigned Jake Bailey (jakebailey) Jul 17, 2024
@typescript-bot TypeScript Bot (typescript-bot) added the Author: Team label Jul 17, 2024
@typescript-bot TypeScript Bot (typescript-bot) assigned Ron Buckton (rbuckton) Jul 17, 2024
@typescript-bot TypeScript Bot (typescript-bot) added the For Milestone Bug PRs that fix a bug with a specific milestone label Jul 17, 2024
@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/59325/merge:

Everything looks good!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 194,103k (± 0.97%) 194,135k (± 0.98%) ~ 192,247k 195,931k p=1.000 n=6
Parse Time 1.30s (± 1.71%) 1.31s (± 0.75%) ~ 1.29s 1.32s p=0.655 n=6
Bind Time 0.71s (± 0.57%) 0.71s ~ ~ ~ p=0.405 n=6
Check Time 9.51s (± 0.22%) 9.53s (± 0.50%) ~ 9.47s 9.60s p=0.422 n=6
Emit Time 2.73s (± 1.26%) 2.73s (± 1.59%) ~ 2.65s 2.77s p=0.935 n=6
Total Time 14.25s (± 0.34%) 14.28s (± 0.18%) ~ 14.25s 14.32s p=0.224 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,120 944,120 ~ ~ ~ p=1.000 n=6
Types 407,047 407,047 ~ ~ ~ p=1.000 n=6
Memory used 1,218,670k (± 0.00%) 1,218,649k (± 0.00%) ~ 1,218,603k 1,218,703k p=0.471 n=6
Parse Time 6.72s (± 0.60%) 6.68s (± 0.73%) ~ 6.60s 6.73s p=0.376 n=6
Bind Time 1.86s (± 0.79%) 1.87s (± 0.73%) ~ 1.85s 1.88s p=0.672 n=6
Check Time 31.03s (± 0.44%) 30.96s (± 0.35%) ~ 30.80s 31.10s p=0.471 n=6
Emit Time 15.02s (± 0.71%) 15.00s (± 0.33%) ~ 14.92s 15.07s p=1.000 n=6
Total Time 54.63s (± 0.34%) 54.52s (± 0.25%) ~ 54.40s 54.74s p=0.261 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,275,944 2,275,944 ~ ~ ~ p=1.000 n=6
Types 948,749 948,749 ~ ~ ~ p=1.000 n=6
Memory used 2,207,308k (± 0.00%) 2,207,244k (± 0.00%) ~ 2,207,134k 2,207,337k p=0.173 n=6
Parse Time 9.69s (± 0.27%) 9.68s (± 0.28%) ~ 9.65s 9.73s p=0.515 n=6
Bind Time 3.39s (± 0.91%) 3.37s (± 0.35%) ~ 3.35s 3.38s p=0.072 n=6
Check Time 105.46s (± 0.52%) 105.78s (± 0.39%) ~ 105.20s 106.24s p=0.298 n=6
Emit Time 0.20s (± 2.06%) 0.20s (± 4.47%) ~ 0.19s 0.21s p=0.787 n=6
Total Time 118.76s (± 0.48%) 119.04s (± 0.35%) ~ 118.46s 119.54s p=0.378 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,101 1,227,101 ~ ~ ~ p=1.000 n=6
Types 261,800 261,800 ~ ~ ~ p=1.000 n=6
Memory used 2,459,002k (±11.76%) 2,340,826k (± 0.03%) ~ 2,339,530k 2,341,579k p=1.000 n=6
Parse Time 5.13s (± 0.93%) 5.12s (± 0.49%) ~ 5.07s 5.14s p=1.000 n=6
Bind Time 1.89s (± 0.78%) 1.90s (± 0.67%) ~ 1.88s 1.92s p=0.392 n=6
Check Time 34.47s (± 0.52%) 34.41s (± 0.29%) ~ 34.25s 34.55s p=1.000 n=6
Emit Time 3.34s (± 1.64%) 3.29s (± 1.54%) ~ 3.21s 3.36s p=0.230 n=6
Total Time 44.84s (± 0.50%) 44.74s (± 0.30%) ~ 44.55s 44.90s p=0.689 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,101 1,227,101 ~ ~ ~ p=1.000 n=6
Types 261,800 261,800 ~ ~ ~ p=1.000 n=6
Memory used 2,415,560k (± 0.02%) 2,415,143k (± 0.01%) ~ 2,414,890k 2,415,531k p=0.229 n=6
Parse Time 5.29s (± 1.09%) 5.25s (± 0.43%) ~ 5.21s 5.28s p=0.229 n=6
Bind Time 1.70s (± 0.81%) 1.70s (± 0.48%) ~ 1.69s 1.71s p=0.868 n=6
Check Time 35.02s (± 0.13%) 34.95s (± 0.36%) ~ 34.76s 35.13s p=0.229 n=6
Emit Time 3.32s (± 2.54%) 3.36s (± 1.50%) ~ 3.27s 3.42s p=0.172 n=6
Total Time 45.35s (± 0.23%) 45.27s (± 0.35%) ~ 45.09s 45.50s p=0.378 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,471 258,471 ~ ~ ~ p=1.000 n=6
Types 104,867 104,867 ~ ~ ~ p=1.000 n=6
Memory used 427,701k (± 0.01%) 427,793k (± 0.03%) ~ 427,665k 427,992k p=0.109 n=6
Parse Time 3.35s (± 0.53%) 3.35s (± 1.25%) ~ 3.30s 3.41s p=0.686 n=6
Bind Time 1.32s (± 1.82%) 1.33s (± 0.63%) ~ 1.31s 1.33s p=1.000 n=6
Check Time 17.96s (± 0.31%) 18.04s (± 0.29%) +0.08s (+ 0.45%) 17.96s 18.12s p=0.043 n=6
Emit Time 1.63s (± 0.93%) 1.63s (± 1.27%) ~ 1.60s 1.66s p=0.405 n=6
Total Time 24.26s (± 0.39%) 24.34s (± 0.13%) ~ 24.29s 24.38s p=0.108 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,607k (± 0.03%) 369,576k (± 0.03%) ~ 369,442k 369,751k p=0.873 n=6
Parse Time 3.43s (± 0.65%) 3.42s (± 0.78%) ~ 3.38s 3.46s p=0.678 n=6
Bind Time 1.94s (± 1.05%) 1.93s (± 0.97%) ~ 1.91s 1.96s p=0.871 n=6
Check Time 19.33s (± 0.27%) 19.32s (± 0.42%) ~ 19.21s 19.45s p=0.748 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.70s (± 0.28%) 24.68s (± 0.36%) ~ 24.56s 24.78s p=0.748 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,971,932 2,971,932 ~ ~ ~ p=1.000 n=6
Types 1,020,692 1,020,692 ~ ~ ~ p=1.000 n=6
Memory used 3,096,420k (± 0.00%) 3,096,375k (± 0.00%) ~ 3,096,313k 3,096,431k p=0.230 n=6
Parse Time 17.07s (± 0.29%) 17.08s (± 0.19%) ~ 17.04s 17.11s p=0.872 n=6
Bind Time 5.25s (± 2.37%) 5.26s (± 2.72%) ~ 5.15s 5.46s p=1.000 n=6
Check Time 96.38s (± 0.23%) 95.97s (± 0.28%) -0.42s (- 0.43%) 95.62s 96.34s p=0.020 n=6
Emit Time 24.98s (± 0.75%) 24.87s (± 0.41%) ~ 24.74s 24.99s p=0.422 n=6
Total Time 143.67s (± 0.22%) 143.17s (± 0.16%) -0.50s (- 0.35%) 142.87s 143.50s p=0.020 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,282 267,282 ~ ~ ~ p=1.000 n=6
Types 108,835 108,835 ~ ~ ~ p=1.000 n=6
Memory used 411,825k (± 0.02%) 411,838k (± 0.02%) ~ 411,763k 411,947k p=1.000 n=6
Parse Time 3.84s (± 0.43%) 3.83s (± 0.49%) ~ 3.81s 3.86s p=1.000 n=6
Bind Time 1.69s (± 0.31%) 1.67s (± 0.82%) ~ 1.66s 1.69s p=0.102 n=6
Check Time 16.80s (± 0.41%) 16.86s (± 0.27%) ~ 16.80s 16.93s p=0.106 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.33s (± 0.28%) 22.37s (± 0.22%) ~ 22.30s 22.42s p=0.296 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,479 510,479 ~ ~ ~ p=1.000 n=6
Types 161,598 161,598 ~ ~ ~ p=1.000 n=6
Memory used 447,985k (± 0.09%) 448,171k (± 0.09%) ~ 447,689k 448,535k p=0.336 n=6
Parse Time 3.15s (± 1.34%) 3.16s (± 0.38%) ~ 3.15s 3.18s p=0.089 n=6
Bind Time 1.18s (± 0.54%) 1.18s (± 1.07%) ~ 1.17s 1.20s p=0.799 n=6
Check Time 17.14s (± 0.48%) 17.15s (± 0.56%) ~ 17.04s 17.27s p=0.571 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 21.47s (± 0.50%) 21.50s (± 0.44%) ~ 21.38s 21.61s p=0.574 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59325/merge:

Everything looks good!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jakebailey

Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

Everything seems fine in the above; Wesley Wigham (@weswigham) is there a major downside to removing this bit?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rbuckton

Ron Buckton (rbuckton) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

I think the only declare that effects runtime emit are declare fields with decorators. Should we preserve all ambients, or should this fix be more narrowly focused?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jakebailey

Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

I think the only declare that effects runtime emit are declare fields with decorators. Should we preserve all ambients, or should this fix be more narrowly focused?

I can scope it down, the trouble is just that there's an "unspecified" hint which is hit from noCheck as it's not actually walking things the same way as we do the checker, so I have to disable it for that category as well. I wasn't sure how bad that'd be, but it did work fine too.

We just didn't have this optimization at all in the original code before #58366 so reverting it seemed okayish.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weswigham
Wesley Wigham (weswigham) reviewed Jul 17, 2024
View reviewed changes
Comment thread src/compiler/checker.ts
if (!canCollectSymbolAliasAccessabilityData) {
return;
}
if (location.flags & NodeFlags.Ambient) {

@weswigham Wesley Wigham (weswigham) Jul 17, 2024

Copy link
Copy Markdown
Member

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.

Yeah, I wouldn't want to remove this outright - perf tests won't show it, but this is pretty important to keep this fast from my testing. I'd just except ambient property signatures from the early skip, since they're like... not really ambient? It looks like when we have something like

class A {
  @decorator(class B {})
  declare prop: string;
}

the prop is ambient marked, but the decorator is not, so we should just be able to except the prop, like Ron Buckton (@rbuckton) says.

if (location.flags & NodeFlags.Ambient && !isPropertySignature(location) && !isPropertyDeclaration(location)) {

seems like it aughta work?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ExE-Boss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@jakebailey Jake Bailey (jakebailey) Jul 17, 2024

Copy link
Copy Markdown
Member Author

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.

Done; that seemed to be enough.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rbuckton Ron Buckton (rbuckton) Jul 17, 2024

Copy link
Copy Markdown
Contributor

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.

declare fields aren't quite as ambient as other declarations. They were added as a compatiblity mechanism due to native class fields using Define semantics, with legacy decorators being one of the main motivations.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jakebailey reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@jakebailey
PR feedback
e6407a8
@jakebailey Jake Bailey (jakebailey) changed the title Don't skip markLinkedReferences on ambients Don't skip markLinkedReferences on ambient properties Jul 17, 2024
@jakebailey
Jake Bailey (jakebailey) requested a review from Wesley Wigham (weswigham) July 17, 2024 20:55
@jakebailey

Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

Updated; PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weswigham
Wesley Wigham (weswigham) approved these changes Jul 17, 2024
View reviewed changes

@weswigham Wesley Wigham (weswigham) left a comment

Copy link
Copy Markdown
Member

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.

Funky to me that we allow a supposedly ambient prop to be decorated at all - seems like that kinda forces it to be non-ambient 🤷‍♂️

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jakebailey

Jake Bailey (jakebailey) commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) cherry-pick this to release-5.5

typescript-bot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
cherry-pick this to release-5.5 ✅ Started ✅ Results
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot TypeScript Bot (typescript-bot) mentioned this pull request Jul 17, 2024
🤖 Pick PR #59325 (Don't skip markLinkedReferences on ...) into release-5.5 #59336
Merged
@typescript-bot

TypeScript Bot (typescript-bot) commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

Hey, Jake Bailey (@jakebailey)! I've created #59336 for you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jakebailey
Jake Bailey (jakebailey) merged commit 95a968c into microsoft:main Jul 17, 2024
@jakebailey
Jake Bailey (jakebailey) deleted the fix-59051 branch July 17, 2024 23:10
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) added this to the TypeScript 5.5.4 milestone Jul 17, 2024
Daniel Rosenwasser (DanielRosenwasser) pushed a commit that referenced this pull request Jul 17, 2024
TypeScript Bot @jakebailey
🤖 Pick PR #59325 (Don't skip markLinkedReferences on ...) into releas…
f35206d
…e-5.5 (#59336)

Co-authored-by: Jake Bailey <[email protected]>
@sandersn Nathan Shively-Sanders (sandersn) removed this from PR Backlog Apr 22, 2025
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@weswigham Wesley Wigham (weswigham) weswigham approved these changes
@andrewbranch Andrew Branch (andrewbranch) Awaiting requested review from andrewbranch
@rbuckton Ron Buckton (rbuckton) Awaiting requested review from rbuckton

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rbuckton Ron Buckton (rbuckton)

@jakebailey Jake Bailey (jakebailey)

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Milestone

TypeScript 5.5.4

Development

Successfully merging this pull request may close these issues.

TS 5.5 - Imports used by decorator output are removed

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@jakebailey @typescript-bot @rbuckton @weswigham @DanielRosenwasser
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.