1.2.2 • Published 14 days ago

@cc-heart/object-to-declare v1.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
14 days ago

object-to-declare

Object-to-Declare is a lightweight utility library that allows developers to easily generate TypeScript type declarations from JavaScript objects or arrays of objects. This can save significant time and effort when writing TypeScript code, especially for large projects or APIs.

install

You can installObject-to-Declare via npm:

npm install @cc-heart/object-to-declare

Usage

Basic Usage

To use Object-to-Declare, simply import the library and call the generateTypeDeclaration function with the object or array of objects you wish to generate a type declaration for:

import generateTypeDeclaration from '@cc-heart/object-to-declare'

const myObject = {
  id: 1,
  name: 'John Smith',
  age: 30,
  email: 'john.smith@example.com',
}

const typeDeclaration = generateTypeDeclaration(myObject)

console.log(typeDeclaration)
// Output: interface IRootName {
//   id: number
//   name: string
//   age: number
//   email: string
// }
1.2.2

14 days ago

1.2.1

14 days ago

1.2.0

22 days ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.1.2

8 months ago

1.0.10

10 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago