Skip to content

Commit 68ce69a

Browse files
committed
Move 'PropertyKey' from es2015.core.d.ts to es5.d.ts
1 parent ff20f38 commit 68ce69a

2 files changed

Lines changed: 7 additions & 40 deletions

File tree

src/lib/es2015.core.d.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
declare type PropertyKey = string | number | symbol;
2-
31
interface Array<T> {
42
/**
53
* Returns the value of the first element in the array where predicate is true, and undefined
@@ -258,20 +256,6 @@ interface NumberConstructor {
258256
parseInt(string: string, radix?: number): number;
259257
}
260258

261-
interface Object {
262-
/**
263-
* Determines whether an object has a property with the specified name.
264-
* @param v A property name.
265-
*/
266-
hasOwnProperty(v: PropertyKey): boolean;
267-
268-
/**
269-
* Determines whether a specified property is enumerable.
270-
* @param v A property name.
271-
*/
272-
propertyIsEnumerable(v: PropertyKey): boolean;
273-
}
274-
275259
interface ObjectConstructor {
276260
/**
277261
* Copy the values of all of the enumerable own properties from one or more source objects to a
@@ -327,25 +311,6 @@ interface ObjectConstructor {
327311
* @param proto The value of the new prototype or null.
328312
*/
329313
setPrototypeOf(o: any, proto: object | null): any;
330-
331-
/**
332-
* Gets the own property descriptor of the specified object.
333-
* An own property descriptor is one that is defined directly on the object and is not
334-
* inherited from the object's prototype.
335-
* @param o Object that contains the property.
336-
* @param p Name of the property.
337-
*/
338-
getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor | undefined;
339-
340-
/**
341-
* Adds a property to an object, or modifies attributes of an existing property.
342-
* @param o Object on which to add or modify the property. This can be a native JavaScript
343-
* object (that is, a user-defined object or a built in object) or a DOM object.
344-
* @param p The property name.
345-
* @param attributes Descriptor for the property. It can be for a data property or an accessor
346-
* property.
347-
*/
348-
defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;
349314
}
350315

351316
interface ReadonlyArray<T> {

src/lib/es5.d.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ declare function escape(string: string): string;
7474
*/
7575
declare function unescape(string: string): string;
7676

77+
declare type PropertyKey = string | number | symbol;
78+
7779
interface PropertyDescriptor {
7880
configurable?: boolean;
7981
enumerable?: boolean;
@@ -104,7 +106,7 @@ interface Object {
104106
* Determines whether an object has a property with the specified name.
105107
* @param v A property name.
106108
*/
107-
hasOwnProperty(v: string): boolean;
109+
hasOwnProperty(v: PropertyKey): boolean;
108110

109111
/**
110112
* Determines whether an object exists in another object's prototype chain.
@@ -116,7 +118,7 @@ interface Object {
116118
* Determines whether a specified property is enumerable.
117119
* @param v A property name.
118120
*/
119-
propertyIsEnumerable(v: string): boolean;
121+
propertyIsEnumerable(v: PropertyKey): boolean;
120122
}
121123

122124
interface ObjectConstructor {
@@ -139,7 +141,7 @@ interface ObjectConstructor {
139141
* @param o Object that contains the property.
140142
* @param p Name of the property.
141143
*/
142-
getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor | undefined;
144+
getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined;
143145

144146
/**
145147
* Returns the names of the own properties of an object. The own properties of an object are those that are defined directly
@@ -167,7 +169,7 @@ interface ObjectConstructor {
167169
* @param p The property name.
168170
* @param attributes Descriptor for the property. It can be for a data property or an accessor property.
169171
*/
170-
defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType<any>): any;
172+
defineProperty(o: any, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): any;
171173

172174
/**
173175
* Adds one or more properties to an object, and/or modifies attributes of existing properties.
@@ -1341,7 +1343,7 @@ type Pick<T, K extends keyof T> = {
13411343
/**
13421344
* Construct a type with a set of properties K of type T
13431345
*/
1344-
type Record<K extends string, T> = {
1346+
type Record<K extends keyof any, T> = {
13451347
[P in K]: T;
13461348
};
13471349

0 commit comments

Comments
 (0)