0.5.0 • Published 1 year ago
types-object v0.5.0
Types Object
Literally just supporting JavaScript Object() in TypeScript.
This includes typing for:
Object()new Object()Object.create()Object.hasOwn()Object.getPrototypeOf()Object.setPrototypeOf()
const love = { is: 'real' } as const
const real = Object(love)
const know = Object.hasOwn(love, 'is')
love.is /* (property) is: "real" */
real /* const real: {
readonly is: "real";
} */
know /* const know: true */Usage
Add types-object to the array of types in compilerOptions, in either tsconfig.json or jsconfig.json.
{
"compilerOptions": {
"types": ["types-object"]
}
}Alternatively, use types-object/constructor if you only wish to include types for Object() and new Object()
{
"compilerOptions": {
"types": ["types-object/constructor"]
}
}