Skip to content

ainuo5213/json-to-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup

yarn add @ainuo-utils/json-to-ts

or

npm install @ainuo-utils/json-to-ts

usage

import json2ts from '@ainuo-utils/json-to-ts';
const data = [
  {
    name: 'ainuo5213',
    age: 24,
    address: {
      country: 'china',
      province: 'sichuan',
      city: 'chengdu'
    },
    favorites: [
      {
        name: 'ping pang',
        score: 97
      }
    ]
  }
];

json2ts(data);
export interface IArrayData {
    name: string;
    age: number;
    address: Address;
    favorites: Favorites[];
}

export interface Address {
    country: string;
    province: string;
    city: string;
}

export interface Favorites {
    name: string;
    score: number;
}

Releases

No releases published

Packages

No packages published