• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import type * as ts from 'typescript';
16
17export const ARE_EQUAL = 'areEqual';
18export const ARE_STRICTLY_EQUAL = 'areStrictlyEqual';
19export const WRAP = 'wrap';
20export const INSTANTIATE = 'instantiate';
21export const LENGTH = 'length';
22export const INVOKE = 'invoke';
23export const INVOKE_METHOD = 'invokeMethod';
24export const TO_PROMISE = 'toPromise';
25export const IS_INSTANCE_OF = 'isInstanceOf';
26
27export const REFLECT_PROPERTIES = [
28  'get',
29  'set',
30  'has',
31  'ownKeys',
32  'getOwnPropertyDescriptor',
33  'defineProperty',
34  'deleteProperty',
35  'apply',
36  'construct',
37  'getPrototypeOf',
38  'setPrototypeOf',
39  'isExtensible',
40  'preventExtensions'
41];
42
43export const OBJECT_PROPERTIES = [
44  'get',
45  'set',
46  'has',
47  'hasOwn',
48  'ownKeys',
49  'keys',
50  'getOwnPropertyDescriptor',
51  'getOwnPropertyDescriptors',
52  'getOwnPropertyName',
53  'defineProperty',
54  'deleteProperty',
55  'apply',
56  'construct',
57  'getPrototypeOf',
58  'setPrototypeOf',
59  'isExtensible',
60  'isFrozen',
61  'isSealed'
62];
63
64export const USE_STATIC = '\'use static\'';
65export const OBJECT_LITERAL = 'Object';
66export const REFLECT_LITERAL = 'Reflect';
67export const NONE = 'none';
68export type ForbidenAPICheckResult = 'Object' | 'Reflect' | 'none';
69export const LOAD = 'load';
70export const GET_PROPERTY = 'getProperty';
71export const SET_PROPERTY = 'setProperty';
72export const TO_NUMBER = 'toNumber';
73
74export enum InteropType {
75  TS = 'TS',
76  JS = 'JS',
77  LEGACY = '1.0',
78  NONE = 'none'
79}
80
81export type IdentifierAndArguments = {
82  ident: undefined | ts.Identifier;
83  args: ts.NodeArray<ts.Expression> | undefined;
84};
85
86export type IncrementDecrementNodeInfo = {
87  varAssignText: string;
88  addOrDecrOperation: ts.BinaryExpression;
89};
90