0.0.9 • Published 5 years ago

@l-l/2dts v0.0.9

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

2dts

api.json转为typescript的类型定义文件

api.json => typing.d.ts

用法

npm install @l-l/2dts
  1. 命令行使用
2dts <path> <output>

例如:

2dts ./api.json ./typing.d.ts
  1. 引入包使用
const todts = require('@l-l/2dts')
const fs = require('fs');

// 读取api.json
const apiJson = JSON.parse(fs.readFileSync('xx/api.json').toString());

// 转换
const dts = todts(apiJson,{
  format: true, // 格式化
  utilType: true // 生成工具类型 
});

// 写
fs.writeFileSync('xx/typing.d.ts',  dts);
0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.1

5 years ago