0.0.2 • Published 11 months ago

js2types v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Generate TypeScript's types from any JavaScript object.

How to use package

Import package from js2types

import Js2Types from "js2types"
const userData = {
    name:"Anthony",
    admin:true,
}
const typeName = "UserData"
const genUserType = new Js2Types(userData,typeName)
const userType = genUserType.type
// Output
//UserData:start
export type UserData = {
    name:string
    admin:boolean
}
//UserData:end

// Save type
js2Types.save(`${process.cwd()}/test/types.ts`)
// Output
//UserData:start
export type UserData = {
    name:string
    admin:boolean
}
//UserData:end
0.0.2

11 months ago

0.0.1

11 months ago

0.0.0

12 months ago