[trusted-types] Properly augment global to prevent conflicts with lib.dom.d.ts et al.
This is the proper patern to augment global interfaces that are defined by the runtime (see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/60837#pullrequestreview-1009631323)
The previous approach would break once lib.dom.d.ts declares these interfaces.
The previous approach also made it impossible for other libraries to use these types. For example, https://github.com/DefinitelyTyped/DefinitelyTyped/pull/60691/ had to be reverted. With proper module augmentation we can land https://github.com/DefinitelyTyped/DefinitelyTyped/pull/60691/ again.
Verified that the new approach will allow landing https://github.com/DefinitelyTyped/DefinitelyTyped/pull/60691/: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/61166
Please fill in this template.
- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [ ] Test the change in your own code. (Compile and run.)
- [x] Add or edit tests to reflect the change.
- [x] Follow the advice from the readme.
- [x] Avoid common mistakes.
- [x] Run
npm test <package to test>.
Select one of these and delete the others:
If changing an existing definition:
- [x] Provide a URL to documentation or source code which provides context for the suggested changes:
- https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML
- https://developer.mozilla.org/en-US/docs/Web/API/TrustedScript
- https://developer.mozilla.org/en-US/docs/Web/API/TrustedScriptURL
- https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy
- https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicyFactory
- ~[ ]~ If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.
@eps1lon Thank you for submitting this PR!
This is a live comment which I will keep updated.
1 package in this PR
@eps1lon: I see that you have added yourself as an owner, are you sure you want to become an owner?
Code Reviews
Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.
You can test the changes of this PR in the Playground.
Status
- ✅ No merge conflicts
- ✅ Continuous integration tests have passed
- ✅ Most recent commit is approved by a DT maintainer
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.
Inactive
This PR has been inactive for 143 days — closed because it wasn't merged for a long time!
Diagnostic Information: What the bot saw about this PR
{
"type": "info",
"now": "-",
"pr_number": 62209,
"author": "eps1lon",
"headCommitOid": "0c07c86af4ab9365aad2b2bc620ee46e2821d7a9",
"mergeBaseOid": "95475aa1500fc36a142b999898c3093617f37776",
"lastPushDate": "2022-07-10T07:56:32.000Z",
"lastActivityDate": "2023-02-14T20:27:09.000Z",
"mergeOfferDate": "2022-09-24T05:09:06.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "trusted-types",
"kind": "edit",
"files": [
{
"path": "types/trusted-types/index.d.ts",
"kind": "definition"
},
{
"path": "types/trusted-types/test/browser.ts",
"kind": "test"
}
],
"owners": [
"vrana",
"engelsdamien",
"siegrift",
"bjarkler"
],
"addedOwners": [
"eps1lon"
],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "RyanCavanaugh",
"date": "2022-09-24T05:08:23.000Z",
"isMaintainer": true
}
],
"mainBotCommentID": 1242998139,
"ciResult": "pass"
}
🔔 @vrana @engelsdamien @siegrift @bjarkler — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.
It has been more than two weeks and this PR still has no reviews.
I'll bump it to the DT maintainer queue. Thank you for your patience, @eps1lon.
(Ping @vrana, @engelsdamien, @siegrift, @bjarkler.)
Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files. The check for missing properties isn't always right, so take this list as advice, not a requirement.
trusted-types (unpkg)
was missing the following properties:
- TrustedTypePolicy
- TrustedTypePolicyFactory
Generated by :no_entry_sign: dangerJS against 0c07c86af4ab9365aad2b2bc620ee46e2821d7a9
@eps1lon: Everything looks good here. I am ready to merge this PR (at 0c07c86) on your behalf whenever you think it's ready.
If you'd like that to happen, please post a comment saying:
Ready to merge
and I'll merge this PR almost instantly. Thanks for helping out! :heart:
(@vrana, @engelsdamien, @siegrift, @bjarkler: you can do this too.)
After a month, no one has requested merging the PR 😞. I'm going to assume that the change is not wanted after all, and will therefore close it.