ts-json-as-const
v1.0.7
Published
A (very) simple CLI tool that reads JSON files and creates .d.ts files with their keys/values explicitly defined
Downloads
5,498
Maintainers
Readme
ts-json-as-const
A (very) simple CLI tool that reads JSON files and creates .d.ts files with their keys/values explicitly defined
Install
npm install ts-json-as-const
Usage
npx ts-json-as-const [path/to/json/file.json ...]
Example
Input example.json
{
"foo": {
"bar": false,
"baz": true,
"i-can": "hascheezburger"
},
"array": [ 1, 2, 3, { "foo": 1, "bar": [ 4, 5 ] }, 6 ]
}
Output example.json.d.ts
interface Example {
foo: {
bar: false;
baz: true;
'i-can': 'hascheezburger';
},
array: [
1,
2,
3,
{
foo: 1;
bar: [
4,
5
]
},
6
]
}
declare const Example: Example;
export = Example;
Author
👤 Bethany Hitch
- Github: @dfoverdx