type-to-value
v0.0.5
Published
> convert typescript type to value
Downloads
9
Readme
type-to-value
convert typescript type to value
How to use
import { TypeToValue } from 'type-to-value';
const typeToValue = new TypeToValue({
sourceFilePath: 'src/**/*.ts', // your project path
// tsConfigFilePath: 'xxx' // tsconfig path
});
// call run to get the convert path,
/**
* @param, type file path
* @param, type to convert
* @param, default value to rewrite
*/
const result = typeToValue.run('src/types/YourType.ts', 'YourType');
// before
interface Data {
a: string
b: number
}
// after
{
"a": "string",
"b": 0,
}
TODO
- playground