Generate typeScript type definitions from JSON
- JSON to typescript
- Loose json specification with automatic formatting error repair
- Provides vscode and utools plugins, cli
search for JSON2DTS install
// install
npm i json2dts-gen
// cli
js2dts -f ./package.json
// or
import generateDeclaration from 'json2dts-gen';
const value = `{
"name": "vscode"
}`
const res = generateDeclaration(value, {
objectSeparate: true
interfacePrefix: 'I'
});
param | describe | default |
---|---|---|
-c | json content | -- |
-f | file path | -- |
-sep | Object types are defined individually | true |
-prefix | interface prefix | -- |
-camelcase | property camelcase | -- |
search for Json2Ts install
npm run test