@@ -74,6 +74,8 @@ declare function escape(string: string): string;
7474 */
7575declare function unescape ( string : string ) : string ;
7676
77+ declare type PropertyKey = string | number | symbol ;
78+
7779interface 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
122124interface 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