File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,17 @@ function isWildcard(accept: string | null) {
4
4
return accept && ! ! accept . split ( ',' ) . find ( x => x . match ( / ^ \s * \* \/ \* / ) )
5
5
}
6
6
7
- // We don't want to add `@types/trusted-types` as a dependency, so we use this stand-in.
8
-
9
- interface CSPTrustedHTMLToStringable {
10
- toString : ( ) => string
11
- }
7
+ // CSP trusted types: We don't want to add `@types/trusted-types` as a
8
+ // dependency, so we use the following types as a stand-in.
12
9
interface CSPTrustedTypesPolicy {
13
10
createHTML : ( s : string , response : Response ) => CSPTrustedHTMLToStringable
14
11
}
12
+ // Note: basically every object (and some primitives) in JS satisfy this
13
+ // `CSPTrustedHTMLToStringable` interface, but this is the most compatible shape
14
+ // we can use.
15
+ interface CSPTrustedHTMLToStringable {
16
+ toString : ( ) => string
17
+ }
15
18
let cspTrustedTypesPolicyPromise : Promise < CSPTrustedTypesPolicy > | null = null
16
19
// Passing `null` clears the policy.
17
20
export function setCSPTrustedTypesPolicy ( policy : CSPTrustedTypesPolicy | Promise < CSPTrustedTypesPolicy > | null ) : void {
You can’t perform that action at this time.
0 commit comments