@hzzlyxx/json2ts
v1.0.2
Published
json转ts接口类型
Downloads
6
Maintainers
Readme
@hzzlyxx/json2ts
How to use
npm install @hzzlyxx/json2ts --save
// or
yarn add @hzzlyxx/json2ts
Examples
import { json2ts } from '@hzzlyxx/json2ts';
const json = {
Button: {
description: '按钮组件',
props: [
{
name: 'htmlType',
type: '"button" | "submit" | "reset"',
default: '',
description: 'Button 类型',
required: false,
},
],
},
};
const ts = json2ts(json);
// ts
export interface Props {
name: string;
type: string;
default: string;
description: string;
required: boolean;
}
export interface Button {
description: string;
props: Props[];
}
export interface RootObject {
button: Button;
}