We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我在创建接口时如下定义
export interface ReqUpdate extends BaseRequest { id: number; info: { projectName?: string; projectOwner?: string; isDel?: boolean; }; }
或是
export type T_project_item = { id: number projectName: string projectOwner: string createTime: string updateTime: string isDel: boolean } export interface ReqUpdate extends BaseRequest { id: number; info: Pick<T_project_item,'id'> }
可以正常编译通过,
但是我的自定义工具类型则报错
export type Nullable<T> = { [Key in keyof T]?: T[Key]; }; export interface ReqUpdate extends BaseRequest { id: number; info: Nullable<Pick<T_project_item,'isDel'| 'projectOwner'>>; }
⨯ Cannot resolve type: { [Key in keyof T]?: T[Key]; } at ../../plugins/typeTool ⨯ ServiceProto 生成失败,请检查 TypeScript 代码是否编译报错: src/shared/protocols/serviceProto.ts
The text was updated successfully, but these errors were encountered:
暂时还不支持完整的 Mapped Type 和泛型,但支持部分工具类型,如 NonNullable Partial 等。 详见:支持的 TypeScript 类型
NonNullable
Partial
你的需求,可以用自带支持的 Partial<T> 来替代自定义的 Nullable<T>
Partial<T>
Nullable<T>
Sorry, something went wrong.
暂时还不支持完整的 Mapped Type 和泛型,但支持部分工具类型,如 NonNullable Partial 等。 详见:支持的 TypeScript 类型 你的需求,可以用自带支持的 Partial<T> 来替代自定义的 Nullable<T>
cool!
No branches or pull requests
我在创建接口时如下定义
或是
可以正常编译通过,
但是我的自定义工具类型则报错
The text was updated successfully, but these errors were encountered: