Skip to content

feat: support generate ts definition files#8

Open
gxcsoccer wants to merge 1 commit into
masterfrom
ts-support
Open

feat: support generate ts definition files#8
gxcsoccer wants to merge 1 commit into
masterfrom
ts-support

Conversation

@gxcsoccer

Copy link
Copy Markdown
Contributor

支持 *.d.ts 文件的生成

@gxcsoccer gxcsoccer requested a review from coolme200 February 3, 2019 08:31
@gxcsoccer gxcsoccer force-pushed the ts-support branch 2 times, most recently from 1213387 to d15c973 Compare February 3, 2019 08:49
@codecov

codecov Bot commented Feb 3, 2019

Copy link
Copy Markdown

Codecov Report

Merging #8 into master will increase coverage by 4.88%.
The diff coverage is 90.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #8      +/-   ##
==========================================
+ Coverage   75.63%   80.52%   +4.88%     
==========================================
  Files           9       10       +1     
  Lines         587      683      +96     
  Branches      127      154      +27     
==========================================
+ Hits          444      550     +106     
+ Misses        143      133      -10
Impacted Files Coverage Δ
lib/proxy_config.js 95% <100%> (ø) ⬆️
lib/nunjucks.js 68.9% <82.6%> (+44.15%) ⬆️
lib/jar2proxy.js 90.44% <90%> (-0.38%) ⬇️
lib/profile_helper.js 95% <95%> (ø)
lib/java/javahome.js 58.92% <0%> (-33.93%) ⬇️
lib/java/platform.js 64.7% <0%> (-23.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 279278f...fd13160. Read the comment docs.

@coolme200

coolme200 commented Feb 11, 2019

Copy link
Copy Markdown
Contributor

对象都用类来表示,然后里面的属性再用 ts 类约束

// Don't modified this file, it's auto created by jar2proxy

interface IUserInfo {
superField: string;
  
  userId: number;
  
  userName: string;
  
  nickName: string;
  
  age: number;
  
  inputProps: { [key: number]: string };
  
  friendNames: string[];
  
  deepArray: string;
  
  normalArray: string;
}

export default class UserInfo {

  constructor(options: Partial<IUserInfo>) {
     // 设置到当前的实例中
  }
 
}

在使用的时候开发者只要 new UserInfo({ ... }); 即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants