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

DOM update 2024-07-12 #59259

Merged
merged 2 commits into from
Jul 18, 2024
Merged

DOM update 2024-07-12 #59259

merged 2 commits into from
Jul 18, 2024

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Jul 12, 2024

I'm doing this early in preparation for adding /** @deferred */ comments on callbacks for 5.6.

Changes:

  • new interface GetHTMLOptions
  • add ImportMeta.resolve
  • new interface MediaKeysPolicy
  • new interface PointerLockOptions
  • delete empty interface RTCRtpCodecCapability, replace with its base type RTCRtpCodec.
  • many MDN links are deleted or added
  • delete interface InnerHTML, inline its property innerHTML where it was used
  • add TextEvent, with associated event properties
  • a few new properties on:
    • CSSStyleDeclaration
    • CanvasState
    • ClipboardItem (+ static side)
    • Document
    • MediaKeys
    • MediaSource
    • PopStateEvent
  • add Element..getHTML, .insertAdjacentHTML, .requestPointerLock
  • Two new events:
    • contextlost
    • contextrestored
  • add HTMLTemplateElement.shadowRootClonable, .shadowRootDelegatesFocus, .shadowRootSerializable
  • new class MediaSourceHandle
  • remove OffscreenCanvasRenderingContext2D.commit
  • add ShadowRoot.serializable, .getHTML
  • URL.canParse's second parameter adds URL to its type; now string | URL
  • URL adds parse methods
  • new class ViewTransition
  • new interface UpdateCallback
  • type Transferable adds MediaSourceHandle to union

Test baseline changes:

  • Nothing substantive except the addition of URL.parse and URL.canParse's second parameter now allowing URL.

I'm doing this early in preparation for adding `/** @deferred */`
comments on callbacks for 5.6.
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jul 12, 2024
@sandersn
Copy link
Member Author

@typescript-bot test this

@sandersn
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 12, 2024

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

Comment on lines -12108 to -12112
/**
* Sets or retrieves a value that you can use to implement your own label functionality for the object.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLOptGroupElement/label)
*/
Copy link
Member

Choose a reason for hiding this comment

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

Why did so many props lose their MDN links?

Choose a reason for hiding this comment

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

They probably have done page cleanup, and for example this link is now 404 (or has always been). Found this relevant PR mdn/browser-compat-data#23481

@typescript-bot
Copy link
Collaborator

Hey @sandersn, the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: dom-view-transitions
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/dom-view-transitions/dom-view-transitions-tests.ts
  5:1  error  TypeScript@local expected type to be:
  Promise<void>
got:
  Promise<undefined>  @definitelytyped/expect
  7:1  error  TypeScript@local expected type to be:
  Promise<void>
got:
  Promise<undefined>  @definitelytyped/expect
  9:1  error  TypeScript@local expected type to be:
  Promise<void>
got:
  Promise<undefined>  @definitelytyped/expect

/mnt/vss/_work/1/DefinitelyTyped/types/dom-view-transitions/index.d.ts
  6:5  error  TypeScript@local compile error: 
All declarations of 'finished' must have identical modifiers                                                                                                      @definitelytyped/expect
  6:5  error  TypeScript@local compile error: 
Subsequent property declarations must have the same type.  Property 'finished' must be of type 'Promise<undefined>', but here has type 'Promise<void>'            @definitelytyped/expect
  7:5  error  TypeScript@local compile error: 
All declarations of 'ready' must have identical modifiers                                                                                                         @definitelytyped/expect
  7:5  error  TypeScript@local compile error: 
Subsequent property declarations must have the same type.  Property 'ready' must be of type 'Promise<undefined>', but here has type 'Promise<void>'               @definitelytyped/expect
  8:5  error  TypeScript@local compile error: 
All declarations of 'updateCallbackDone' must have identical modifiers                                                                                            @definitelytyped/expect
  8:5  error  TypeScript@local compile error: 
Subsequent property declarations must have the same type.  Property 'updateCallbackDone' must be of type 'Promise<undefined>', but here has type 'Promise<void>'  @definitelytyped/expect

✖ 9 problems (9 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: chrome-apps
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/chrome-apps/test/index.ts
  2182:21  error  TypeScript@local compile error: 
Conversion of type 'Element | null' to type 'HTMLElement' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'Element' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 128 more  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: node/v16
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/node/v16/module.d.ts
  213:13  error  TypeScript@local tsconfig.dom.json compile error: 
Overload signatures must all be optional or required  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: node/v18
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/node/v18/module.d.ts
  290:13  error  TypeScript@local tsconfig.dom.json compile error: 
Overload signatures must all be optional or required  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.22_typescript@5.6.0-dev.20240712/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

You can check the log here.

@typescript-bot
Copy link
Collaborator

@sandersn Here are the results of running the user tests with tsc comparing main and refs/pull/59259/merge:

Something interesting changed - please have a look.

Details

azure-sdk

/mnt/ts_downloads/_/m/azure-sdk/build.sh

  • [MISSING] error TS2322: Type 'string' is not assignable to type 'never'.
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(59,9)
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(213,9)
    • /mnt/ts_downloads/_/m/azure-sdk/test/narrowedTypes.ts(254,11)

effect

tsconfig.base.json

xterm.js

src/tsconfig-library-base.json

  • [NEW] error TS2386: Overload signatures must all be optional or required.

@jakebailey
Copy link
Member

This is scary:

/mnt/vss/_work/1/DefinitelyTyped/types/node/v18/module.d.ts
  290:13  error  TypeScript@local tsconfig.dom.json compile error: 
Overload signatures must all be optional or required  @definitelytyped/expect

@typescript-bot
Copy link
Collaborator

@sandersn
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 193,536k (± 0.92%) 192,183k (± 0.02%) -1,353k (- 0.70%) 192,128k 192,236k p=0.020 n=6
Parse Time 1.30s (± 1.02%) 1.30s (± 0.79%) ~ 1.29s 1.32s p=0.356 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.44s (± 0.30%) 9.45s (± 0.83%) ~ 9.34s 9.55s p=0.518 n=6
Emit Time 2.76s (± 0.56%) 2.76s (± 0.53%) ~ 2.73s 2.77s p=0.557 n=6
Total Time 14.21s (± 0.20%) 14.22s (± 0.63%) ~ 14.11s 14.33s p=0.468 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,244 +130 (+ 0.01%) ~ ~ p=0.001 n=6
Types 407,050 407,079 +29 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,218,396k (± 0.01%) 1,218,468k (± 0.01%) ~ 1,218,388k 1,218,570k p=0.173 n=6
Parse Time 6.73s (± 0.32%) 6.70s (± 0.84%) ~ 6.63s 6.77s p=0.574 n=6
Bind Time 1.88s (± 0.34%) 1.88s (± 0.58%) ~ 1.87s 1.90s p=0.787 n=6
Check Time 30.63s (± 0.50%) 30.64s (± 0.28%) ~ 30.51s 30.73s p=0.520 n=6
Emit Time 13.64s (± 0.29%) 13.60s (± 0.51%) ~ 13.48s 13.66s p=0.198 n=6
Total Time 52.88s (± 0.31%) 52.81s (± 0.28%) ~ 52.63s 53.00s p=1.000 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,148,730 2,148,823 +93 (+ 0.00%) ~ ~ p=0.001 n=6
Types 929,320 929,343 +23 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 2,116,431k (± 0.01%) 2,116,467k (± 0.00%) ~ 2,116,379k 2,116,559k p=0.471 n=6
Parse Time 6.58s (± 0.23%) 6.59s (± 0.25%) ~ 6.56s 6.61s p=0.367 n=6
Bind Time 2.34s (± 0.90%) 2.32s (± 0.27%) -0.02s (- 0.85%) 2.31s 2.33s p=0.024 n=6
Check Time 70.33s (± 1.06%) 70.80s (± 0.27%) ~ 70.52s 71.00s p=0.173 n=6
Emit Time 0.14s (± 2.95%) 0.14s ~ ~ ~ p=0.405 n=6
Total Time 79.38s (± 0.92%) 79.85s (± 0.23%) ~ 79.59s 80.03s p=0.199 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,226,005 1,226,005 ~ ~ ~ p=1.000 n=6
Types 261,615 261,615 ~ ~ ~ p=1.000 n=6
Memory used 2,338,375k (± 0.01%) 2,338,735k (± 0.03%) ~ 2,337,937k 2,339,471k p=0.378 n=6
Parse Time 5.06s (± 0.84%) 5.07s (± 0.73%) ~ 5.01s 5.11s p=0.810 n=6
Bind Time 1.90s (± 0.67%) 1.91s (± 0.80%) ~ 1.89s 1.93s p=0.677 n=6
Check Time 34.13s (± 0.33%) 34.13s (± 0.11%) ~ 34.06s 34.17s p=1.000 n=6
Emit Time 3.26s (± 1.68%) 3.24s (± 1.75%) ~ 3.19s 3.34s p=0.574 n=6
Total Time 44.38s (± 0.30%) 44.35s (± 0.18%) ~ 44.20s 44.41s p=1.000 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,226,005 1,226,005 ~ ~ ~ p=1.000 n=6
Types 261,615 261,615 ~ ~ ~ p=1.000 n=6
Memory used 2,413,418k (± 0.02%) 2,413,049k (± 0.02%) ~ 2,412,644k 2,413,669k p=0.298 n=6
Parse Time 6.33s (± 0.74%) 6.34s (± 0.38%) ~ 6.31s 6.38s p=0.378 n=6
Bind Time 2.02s (± 1.68%) 2.02s (± 0.58%) ~ 2.01s 2.04s p=0.936 n=6
Check Time 40.88s (± 0.27%) 40.81s (± 0.18%) ~ 40.72s 40.88s p=0.298 n=6
Emit Time 3.94s (± 0.78%) 3.92s (± 0.88%) ~ 3.89s 3.97s p=0.296 n=6
Total Time 53.16s (± 0.16%) 53.11s (± 0.15%) ~ 53.01s 53.21s p=0.378 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,315 258,315 ~ ~ ~ p=1.000 n=6
Types 104,817 104,817 ~ ~ ~ p=1.000 n=6
Memory used 427,152k (± 0.02%) 427,174k (± 0.02%) ~ 427,069k 427,359k p=0.810 n=6
Parse Time 3.31s (± 0.63%) 3.30s (± 0.57%) ~ 3.29s 3.34s p=0.805 n=6
Bind Time 1.31s (± 1.18%) 1.30s (± 1.05%) ~ 1.29s 1.32s p=0.452 n=6
Check Time 17.77s (± 0.14%) 17.82s (± 0.32%) ~ 17.75s 17.90s p=0.146 n=6
Emit Time 1.64s (± 1.30%) 1.65s (± 0.83%) ~ 1.63s 1.67s p=0.511 n=6
Total Time 24.03s (± 0.18%) 24.08s (± 0.25%) ~ 24.00s 24.14s p=0.261 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,509k (± 0.03%) 369,569k (± 0.03%) ~ 369,465k 369,744k p=0.689 n=6
Parse Time 3.41s (± 0.97%) 3.43s (± 0.50%) ~ 3.41s 3.46s p=0.295 n=6
Bind Time 1.92s (± 0.27%) 1.92s (± 0.54%) ~ 1.91s 1.94s p=0.928 n=6
Check Time 19.16s (± 0.27%) 19.18s (± 0.38%) ~ 19.10s 19.27s p=0.629 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.50s (± 0.26%) 24.53s (± 0.29%) ~ 24.45s 24.62s p=0.260 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,891,026 2,891,199 +173 (+ 0.01%) ~ ~ p=0.001 n=6
Types 978,080 978,131 +51 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 3,054,687k (± 0.00%) 3,054,766k (± 0.00%) ~ 3,054,662k 3,054,830k p=0.078 n=6
Parse Time 16.96s (± 0.21%) 16.92s (± 0.12%) ~ 16.89s 16.94s p=0.076 n=6
Bind Time 5.13s (± 0.40%) 5.14s (± 0.99%) ~ 5.10s 5.24s p=0.936 n=6
Check Time 89.71s (± 0.22%) 89.70s (± 0.35%) ~ 89.31s 90.22s p=0.936 n=6
Emit Time 29.32s (± 0.44%) 29.23s (± 1.17%) ~ 28.90s 29.86s p=0.261 n=6
Total Time 141.12s (± 0.20%) 140.99s (± 0.41%) ~ 140.63s 142.16s p=0.128 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,239 267,327 +88 (+ 0.03%) ~ ~ p=0.001 n=6
Types 108,815 108,842 +27 (+ 0.02%) ~ ~ p=0.001 n=6
Memory used 411,850k (± 0.01%) 411,888k (± 0.02%) ~ 411,795k 411,999k p=0.688 n=6
Parse Time 4.76s (± 0.42%) 4.75s (± 0.72%) ~ 4.71s 4.80s p=0.625 n=6
Bind Time 2.08s (± 1.03%) 2.09s (± 0.82%) ~ 2.07s 2.11s p=0.514 n=6
Check Time 20.75s (± 0.51%) 20.79s (± 0.22%) ~ 20.74s 20.87s p=0.748 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.59s (± 0.43%) 27.63s (± 0.25%) ~ 27.55s 27.75s p=0.872 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,479 510,573 +94 (+ 0.02%) ~ ~ p=0.001 n=6
Types 161,600 161,623 +23 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 447,786k (± 0.03%) 447,970k (± 0.07%) ~ 447,673k 448,461k p=0.378 n=6
Parse Time 3.15s (± 0.56%) 3.16s (± 1.29%) ~ 3.10s 3.22s p=0.493 n=6
Bind Time 1.17s (± 0.64%) 1.17s (± 0.35%) ~ 1.16s 1.17s p=1.000 n=6
Check Time 17.04s (± 0.51%) 17.00s (± 0.23%) ~ 16.96s 17.07s p=0.519 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 21.36s (± 0.38%) 21.33s (± 0.20%) ~ 21.28s 21.39s p=0.688 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

@typescript-bot
Copy link
Collaborator

@sandersn Here are the results of running the top 400 repos with tsc comparing main and refs/pull/59259/merge:

Something interesting changed - please have a look.

Details

Chocobozzz/PeerTube

6 of 12 projects failed to build with the old tsc and were ignored

packages/types-generator/tsconfig.types.json

  • error TS2386: Overload signatures must all be optional or required.

mattermost/mattermost

2 of 4 projects failed to build with the old tsc and were ignored

webapp/platform/client/tsconfig.build.json

vercel/hyper

2 of 3 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2386: Overload signatures must all be optional or required.
    • file:///mnt/ts_downloads/_/m/hyper/node_modules/@types/node/module.d.ts#L290 in app/tsconfig.json
    • file:///mnt/ts_downloads/_/m/hyper/node_modules/@types/node/module.d.ts#L290 in tsconfig.json

@sandersn
Copy link
Member Author

This PR adds ImportMeta.resolve as a non-optional method:

interface ImportMeta {
    url: string;
    resolve(specifier: string): string;
}

But resolve is still experimental-only in node 16 and 18. Node versions really need an associated DOM version instead of all claiming to work with the newest.
(and of course node technically shouldn't depend on the DOM at all.)

@sandersn
Copy link
Member Author

After discussing with @andrewbranch we decided to make ImportMeta.resolve required in node 16 and 18 as well. Forcing a null check before usage isn't the right way to handle experimental features in the first place. I'd prefer to delete resolve, but that will break existing dependents of node 16/18.

The correct way would have been to have a separate experimental package, probably.

@sandersn
Copy link
Member Author

DefinitelyTyped/DefinitelyTyped#70054 is merged now, so I'm going to merge this after resolving the baseline conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants