
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
interface2class
Advanced tools
一个通过 interface 生成 class 的命令行工具,适用于 TS 和 ArkTS
npm i interface2class -g
demo.tsenum Gender {
MAN = 'men',
WOMAN = 'women'
}
interface Response {
code: number
message: string
data: User
}
interface User {
nickname: string
age: number
avatar: ResourceStr
createAt: Date
gender: Gender
hobby: string[]
follows: User[]
isValid: 0 | 1
}
i2c ./demo.ts
demo.tsenum Gender {
MAN = 'men',
WOMAN = 'women'
}
interface Response {
code: number
message: string
data: User
}
interface User {
nickname: string
age: number
avatar: ResourceStr
createAt: Date
gender: Gender
hobby: string[]
follows: User[]
isValid: 0 | 1
}
// auto gen →
export class ResponseModel implements Response {
code: number = 0
message: string = ''
data: User = new UserModel({} as User)
constructor(model: Response) {
this.code = model.code
this.message = model.message
this.data = model.data
}
}
export class UserModel implements User {
nickname: string = ''
age: number = 0
avatar: ResourceStr = ''
createAt: Date = new Date()
gender: Gender = Gender.MAN
hobby: string[] = []
follows: User[] = []
isValid: 0 | 1 = 0
constructor(model: User) {
this.nickname = model.nickname
this.age = model.age
this.avatar = model.avatar
this.createAt = model.createAt
this.gender = model.gender
this.hobby = model.hobby
this.follows = model.follows
this.isValid = model.isValid
}
}
如果出现生成 class 失败,请格式化后再生成
demo.ts/**
* 报文数据
*/
export interface Data {
/**
* 总页数
*/
pageTotal?: number;
/**
* 数据集合
*/
rows?: Row[];
/**
* 总数
*/
total?: number;
[property: string]: any;
}
i2c format ./demo.ts
demo.ts/** 报文数据 */
export interface Data {
/** 总页数 */
pageTotal: number | null;
/** 数据集合 */
rows: Row[] | null;
/** 总数 */
total: number | null;
}
FAQs
interface gen class
The npm package interface2class receives a total of 4 weekly downloads. As such, interface2class popularity was classified as not popular.
We found that interface2class demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.