1.0.2 • Published 2 years ago

@hzzlyxx/json2ts v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@hzzlyxx/json2ts

NPM version NPM download

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;
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago