Last active
December 31, 2019 18:21
-
-
Save anthonynichols/3de3bb055283b10727b6cbe856f2d272 to your computer and use it in GitHub Desktop.
Type definition for `Object` in Javascript with missing `Object.entries` definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare interface ObjectConstructor { | |
/** | |
* Returns an array of values of the enumerable properties of an object | |
* @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. | |
*/ | |
values<T>(o: { [s: string]: T } | ArrayLike<T>): T[]; | |
/** | |
* Returns an array of values of the enumerable properties of an object | |
* @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. | |
*/ | |
values(o: {}): any[]; | |
/** | |
* Returns an array of key/values of the enumerable properties of an object | |
* @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. | |
*/ | |
entries<T extends { [key: string]: any }, K extends keyof T>(o: T): [keyof T, T[K]][]; | |
/** | |
* Returns an array of key/values of the enumerable properties of an object | |
* @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. | |
*/ | |
entries<T>(o: { [s: string]: T } | ArrayLike<T>): [string, T][]; | |
/** | |
* Returns an array of key/values of the enumerable properties of an object | |
* @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. | |
*/ | |
entries(o: {}): [string, any][]; | |
/** | |
* Returns an object containing all own property descriptors of an object | |
* @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. | |
*/ | |
getOwnPropertyDescriptors<T>(o: T): {[P in keyof T]: TypedPropertyDescriptor<T[P]>} & { [x: string]: PropertyDescriptor }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment