(@zhjh) 在 TypeScript 开发中有必要给返回值或入参写 interface 吗? 中发帖
运行的时候就算传错了也不会报错,而且每次调整参数的时候还要调整 interface
// 角色编辑表单
interface RoleEditForm {
id: string | null // ID
name: string // 名称
code: string // 编码
sort: number, // 顺序
status: number, // 状态
description: string // 描述
}
class RoleApi {
static baseUrl = '/sys/roles'
/**
* 保存
* @param query 编辑表单
* @param option 请求配置
*/
static async save(query: RoleEditForm, option?: FetchOption...