1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | /**
|
---|
9 | * While Angular only uses Trusted Types internally for the time being,
|
---|
10 | * references to Trusted Types could leak into our core.d.ts, which would force
|
---|
11 | * anyone compiling against @angular/core to provide the @types/trusted-types
|
---|
12 | * package in their compilation unit.
|
---|
13 | *
|
---|
14 | * Until https://github.com/microsoft/TypeScript/issues/30024 is resolved, we
|
---|
15 | * will keep Angular's public API surface free of references to Trusted Types.
|
---|
16 | * For internal and semi-private APIs that need to reference Trusted Types, the
|
---|
17 | * minimal type definitions for the Trusted Types API provided by this module
|
---|
18 | * should be used instead. They are marked as "declare" to prevent them from
|
---|
19 | * being renamed by compiler optimization.
|
---|
20 | *
|
---|
21 | * Adapted from
|
---|
22 | * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/trusted-types/index.d.ts
|
---|
23 | * but restricted to the API surface used within Angular.
|
---|
24 | */
|
---|
25 | export declare interface TrustedScript {
|
---|
26 | __brand__: 'TrustedScript';
|
---|
27 | }
|
---|
28 | export declare interface TrustedTypePolicyFactory {
|
---|
29 | createPolicy(policyName: string, policyOptions: {
|
---|
30 | createScript?: (input: string) => string;
|
---|
31 | }): TrustedTypePolicy;
|
---|
32 | }
|
---|
33 | export declare interface TrustedTypePolicy {
|
---|
34 | createScript(input: string): TrustedScript;
|
---|
35 | }
|
---|
36 | /**
|
---|
37 | * Unsafely call the Function constructor with the given string arguments.
|
---|
38 | * @security This is a security-sensitive function; any use of this function
|
---|
39 | * must go through security review. In particular, it must be assured that it
|
---|
40 | * is only called from the JIT compiler, as use in other code can lead to XSS
|
---|
41 | * vulnerabilities.
|
---|
42 | */
|
---|
43 | export declare function newTrustedFunctionForJIT(...args: string[]): Function;
|
---|