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) {
44 return accept && ! ! accept . split ( ',' ) . find ( x => x . match ( / ^ \s * \* \/ \* / ) )
55}
66
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.
129interface CSPTrustedTypesPolicy {
1310 createHTML : ( s : string , response : Response ) => CSPTrustedHTMLToStringable
1411}
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+ }
1518let cspTrustedTypesPolicyPromise : Promise < CSPTrustedTypesPolicy > | null = null
1619// Passing `null` clears the policy.
1720export function setCSPTrustedTypesPolicy ( policy : CSPTrustedTypesPolicy | Promise < CSPTrustedTypesPolicy > | null ) : void {
You can’t perform that action at this time.
0 commit comments