🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@hzzlyxx/json2ts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hzzlyxx/json2ts

json转ts接口类型

1.0.2
latest
Source
npm
Version published
Maintainers
1
Created
Source

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

Keywords

json2ts

FAQs

Package last updated on 07 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts