jsonc2type
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

jsonc2type

description

json with comment string translate to typescript to type!

how to use

import jsonc2type from 'jsonc2type';

const jsonc2type(`{
  a: 'aaaa', // comments
  b: 1234, // comments
  c: {a: 13432, d: '13424'}
}`, { startNode: 'c', name: 'type'})
/* type Type = {
  a: number,
  d: string,
}
*/

const jsonc2type(`{
  a: 'aaaa', // comments
  b: 1234, // comments
  c: {a: 13432, d: '13424'}
}`, { startNode: 'type', name: 'type'})
/* type Type = {
*  /* comments */
*  a: string,
*  /* comments */
*  d: string,
*  c: {
*    a: number,
*    d: string,
*  }
* }
*/

Dependents (1)

Package Sidebar

Install

npm i jsonc2type

Weekly Downloads

7

Version

1.0.4

License

MIT

Unpacked Size

24.8 kB

Total Files

16

Last publish

Collaborators

  • hahazml