Skip to content

Literally just supporting JavaScript Object() in TypeScript

Notifications You must be signed in to change notification settings

jsxtools/types-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"]
  }
}

About

Literally just supporting JavaScript Object() in TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published