0.5.0 • Published 2 years ago
types-object
Licence
CC0-1.0
Version
0.5.0
Deps
0
Size
3 kB
Vulns
0
Weekly
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"]
}
}