|
| 1 | +/// <reference no-default-lib="true" /> |
| 2 | + |
| 3 | +/** |
| 4 | + * Evaluates JavaScript code and executes it. |
| 5 | + * @param x A String value that contains valid JavaScript code. |
| 6 | + */ |
| 7 | +declare function eval(x: string): unknown; |
| 8 | + |
| 9 | +interface ObjectConstructor { |
| 10 | + new (value?: any): Object; |
| 11 | + (): {}; |
| 12 | + <T>(value: T): T extends object ? T : {}; |
| 13 | + |
| 14 | + /** A reference to the prototype for a class of objects. */ |
| 15 | + readonly prototype: Object; |
| 16 | + |
| 17 | + /** |
| 18 | + * Returns the prototype of an object. |
| 19 | + * @param o The object that references the prototype. |
| 20 | + */ |
| 21 | + getPrototypeOf(o: any): unknown; |
| 22 | + |
| 23 | + /** |
| 24 | + * Gets the own property descriptor of the specified object. |
| 25 | + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. |
| 26 | + * @param o Object that contains the property. |
| 27 | + * @param p Name of the property. |
| 28 | + */ |
| 29 | + getOwnPropertyDescriptor( |
| 30 | + o: any, |
| 31 | + p: PropertyKey |
| 32 | + ): PropertyDescriptor | undefined; |
| 33 | + |
| 34 | + /** |
| 35 | + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly |
| 36 | + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. |
| 37 | + * @param o Object that contains the own properties. |
| 38 | + */ |
| 39 | + getOwnPropertyNames(o: any): string[]; |
| 40 | + |
| 41 | + /** |
| 42 | + * Creates an object that has the specified prototype or that has null prototype. |
| 43 | + * @param o Object to use as a prototype. May be null. |
| 44 | + */ |
| 45 | + create(o: object | null): {}; |
| 46 | + |
| 47 | + /** |
| 48 | + * Creates an object that has the specified prototype, and that optionally contains specified properties. |
| 49 | + * @param o Object to use as a prototype. May be null |
| 50 | + * @param properties JavaScript object that contains one or more property descriptors. |
| 51 | + */ |
| 52 | + create<P extends Record<string, PropertyDescriptor>>( |
| 53 | + o: object | null, |
| 54 | + properties: P & ThisType<any> |
| 55 | + ): { |
| 56 | + [K in keyof P]: P[K] extends { value: infer V } |
| 57 | + ? V |
| 58 | + : P[K] extends { get: () => infer V } |
| 59 | + ? V |
| 60 | + : unknown; |
| 61 | + }; |
| 62 | + |
| 63 | + /** |
| 64 | + * Adds a property to an object, or modifies attributes of an existing property. |
| 65 | + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. |
| 66 | + * @param p The property name. |
| 67 | + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. |
| 68 | + */ |
| 69 | + defineProperty<O, K extends PropertyKey, D extends PropertyDescriptor>( |
| 70 | + o: O, |
| 71 | + p: K, |
| 72 | + attributes: D & ThisType<any> |
| 73 | + ): O & |
| 74 | + (K extends PropertyKey |
| 75 | + ? Record< |
| 76 | + K, |
| 77 | + D extends { value: infer V } |
| 78 | + ? V |
| 79 | + : D extends { get: () => infer V } |
| 80 | + ? V |
| 81 | + : unknown |
| 82 | + > |
| 83 | + : unknown); |
| 84 | + |
| 85 | + /** |
| 86 | + * Adds one or more properties to an object, and/or modifies attributes of existing properties. |
| 87 | + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. |
| 88 | + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. |
| 89 | + */ |
| 90 | + defineProperties<O, P extends Record<PropertyKey, PropertyDescriptor>>( |
| 91 | + o: O, |
| 92 | + properties: P & ThisType<any> |
| 93 | + ): { |
| 94 | + [K in keyof (O & P)]: P[K] extends { value: infer V } |
| 95 | + ? V |
| 96 | + : P[K] extends { get: () => infer V } |
| 97 | + ? V |
| 98 | + : K extends keyof O |
| 99 | + ? O[K] |
| 100 | + : unknown; |
| 101 | + }; |
| 102 | + |
| 103 | + /** |
| 104 | + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. |
| 105 | + * @param o Object on which to lock the attributes. |
| 106 | + */ |
| 107 | + seal<T>(o: T): T; |
| 108 | + |
| 109 | + /** |
| 110 | + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. |
| 111 | + * @param o Object on which to lock the attributes. |
| 112 | + */ |
| 113 | + freeze<T>(a: T[]): readonly T[]; |
| 114 | + |
| 115 | + /** |
| 116 | + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. |
| 117 | + * @param o Object on which to lock the attributes. |
| 118 | + */ |
| 119 | + freeze<T extends Function>(f: T): T; |
| 120 | + |
| 121 | + /** |
| 122 | + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. |
| 123 | + * @param o Object on which to lock the attributes. |
| 124 | + */ |
| 125 | + freeze<T>(o: T): Readonly<T>; |
| 126 | + |
| 127 | + /** |
| 128 | + * Prevents the addition of new properties to an object. |
| 129 | + * @param o Object to make non-extensible. |
| 130 | + */ |
| 131 | + preventExtensions<T>(o: T): T; |
| 132 | + |
| 133 | + /** |
| 134 | + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. |
| 135 | + * @param o Object to test. |
| 136 | + */ |
| 137 | + isSealed(o: any): boolean; |
| 138 | + |
| 139 | + /** |
| 140 | + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. |
| 141 | + * @param o Object to test. |
| 142 | + */ |
| 143 | + isFrozen(o: any): boolean; |
| 144 | + |
| 145 | + /** |
| 146 | + * Returns a value that indicates whether new properties can be added to an object. |
| 147 | + * @param o Object to test. |
| 148 | + */ |
| 149 | + isExtensible(o: any): boolean; |
| 150 | + |
| 151 | + /** |
| 152 | + * Returns the names of the enumerable string properties and methods of an object. |
| 153 | + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. |
| 154 | + */ |
| 155 | + keys(o: object): string[]; |
| 156 | +} |
0 commit comments