Pick up latest @types/trusted-types

Should unblock #270041
This commit is contained in:
Matt Bierner 2025-10-13 11:59:50 -07:00
parent 549db2afe3
commit ab54a72364
No known key found for this signature in database
GPG Key ID: 87BD15F7203A4CF2
6 changed files with 16 additions and 16 deletions

11
package-lock.json generated
View File

@ -71,7 +71,7 @@
"@types/node": "22.x",
"@types/sinon": "^10.0.2",
"@types/sinon-test": "^2.4.2",
"@types/trusted-types": "^1.0.6",
"@types/trusted-types": "^2.0.7",
"@types/vscode-notebook-renderer": "^1.72.0",
"@types/webpack": "^5.28.5",
"@types/wicg-file-system-access": "^2023.10.7",
@ -2155,10 +2155,11 @@
"dev": true
},
"node_modules/@types/trusted-types": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz",
"integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw==",
"dev": true
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/tunnel": {
"version": "0.0.3",

View File

@ -132,7 +132,7 @@
"@types/node": "22.x",
"@types/sinon": "^10.0.2",
"@types/sinon-test": "^2.4.2",
"@types/trusted-types": "^1.0.6",
"@types/trusted-types": "^2.0.7",
"@types/vscode-notebook-renderer": "^1.72.0",
"@types/webpack": "^5.28.5",
"@types/wicg-file-system-access": "^2023.10.7",

View File

@ -7,10 +7,9 @@
declare global {
var _VSCODE_WEB_PACKAGE_TTP: Pick<TrustedTypePolicy<{
createScriptURL(value: string): string;
}>, 'name' | 'createScriptURL'> | undefined;
var _VSCODE_WEB_PACKAGE_TTP: Pick<TrustedTypePolicy, 'name' | 'createScriptURL'> | undefined;
}
// fake export to make global work
export { }
export { };

View File

@ -38,9 +38,7 @@ class AMDModuleImporter {
private readonly _defineCalls: DefineCall[] = [];
private _state = AMDModuleImporterState.Uninitialized;
private _amdPolicy: Pick<TrustedTypePolicy<{
createScriptURL(value: string): string;
}>, 'name' | 'createScriptURL'> | undefined;
private _amdPolicy: Pick<TrustedTypePolicy, 'name' | 'createScriptURL'> | undefined;
constructor() { }

View File

@ -5,16 +5,18 @@
import { onUnexpectedError } from '../common/errors.js';
type TrustedTypePolicyOptions = import('trusted-types/lib/index.d.ts').TrustedTypePolicyOptions;
export function createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
policyName: string,
policyOptions?: Options,
): undefined | Pick<TrustedTypePolicy<Options>, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>> {
): undefined | Pick<TrustedTypePolicy, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>> {
interface IMonacoEnvironment {
createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
policyName: string,
policyOptions?: Options,
): undefined | Pick<TrustedTypePolicy<Options>, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>>;
): undefined | Pick<TrustedTypePolicy, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>>;
}
// eslint-disable-next-line local/code-no-any-casts
const monacoEnvironment: IMonacoEnvironment | undefined = (globalThis as any).MonacoEnvironment;

View File

@ -73,7 +73,7 @@
}
globalThis._VSCODE_FILE_ROOT = baseUrl;
const trustedTypesPolicy: Pick<TrustedTypePolicy<{ createScriptURL(value: string): string }>, 'name' | 'createScriptURL'> | undefined = require.getConfig().trustedTypesPolicy;
const trustedTypesPolicy: Pick<TrustedTypePolicy, 'name' | 'createScriptURL'> | undefined = require.getConfig().trustedTypesPolicy;
if (trustedTypesPolicy) {
globalThis._VSCODE_WEB_PACKAGE_TTP = trustedTypesPolicy;
}