Avoid using types defined in @types/trusted-types

This commit is contained in:
Alex Dima 2023-06-02 12:32:46 +02:00
parent d823366750
commit 1331522372
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
2 changed files with 34 additions and 8 deletions

View file

@ -34,12 +34,25 @@ declare namespace monaco {
*/
getWorkerUrl?(workerId: string, label: string): string;
/**
* Create a trust types policy (same API as window.trustedTypes.createPolicy)
* Create a trusted types policy (same API as window.trustedTypes.createPolicy)
*/
createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
createTrustedTypesPolicy(
policyName: string,
policyOptions?: Options,
): undefined | Pick<TrustedTypePolicy<Options>, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>>;
policyOptions?: ITrustedTypePolicyOptions,
): undefined | ITrustedTypePolicy;
}
export interface ITrustedTypePolicyOptions {
createHTML?: (input: string, ...arguments: any[]) => string;
createScript?: (input: string, ...arguments: any[]) => string;
createScriptURL?: (input: string, ...arguments: any[]) => string;
}
export interface ITrustedTypePolicy {
readonly name: string;
createHTML?(input: string): any;
createScript?(input: string): any;
createScriptURL?(input: string): any;
}
export interface IDisposable {

21
src/vs/monaco.d.ts vendored
View file

@ -34,12 +34,25 @@ declare namespace monaco {
*/
getWorkerUrl?(workerId: string, label: string): string;
/**
* Create a trust types policy (same API as window.trustedTypes.createPolicy)
* Create a trusted types policy (same API as window.trustedTypes.createPolicy)
*/
createTrustedTypesPolicy<Options extends TrustedTypePolicyOptions>(
createTrustedTypesPolicy(
policyName: string,
policyOptions?: Options,
): undefined | Pick<TrustedTypePolicy<Options>, 'name' | Extract<keyof Options, keyof TrustedTypePolicyOptions>>;
policyOptions?: ITrustedTypePolicyOptions,
): undefined | ITrustedTypePolicy;
}
export interface ITrustedTypePolicyOptions {
createHTML?: (input: string, ...arguments: any[]) => string;
createScript?: (input: string, ...arguments: any[]) => string;
createScriptURL?: (input: string, ...arguments: any[]) => string;
}
export interface ITrustedTypePolicy {
readonly name: string;
createHTML?(input: string): any;
createScript?(input: string): any;
createScriptURL?(input: string): any;
}
export interface IDisposable {