如果我有自动创建的代码
export declare type IOptions = {
allowNonNativeSlash?: boolean;
allowNonNativeFlags?: boolean;
throwError?: boolean;
};
export declare function parseRegularExpressionString(str: string, options?: IOptions): {
source: string;
flags: string;
slash: string;
input: string;
};
但我希望它像这样自动创建
export declare type IOptions = {
allowNonNativeSlash?: boolean;
allowNonNativeFlags?: boolean;
throwError?: boolean;
};
export declare function parseRegularExpressionString(str: string, options?: {
allowNonNativeSlash?: boolean;
allowNonNativeFlags?: boolean;
throwError?: boolean;
}): {
source: string;
flags: string;
slash: string;
input: string;
};
任何方式都可以做到这一点?
有些时候我觉得当我在其他项目导入时,它将无法知道什么是选项
有时我做的事情(不是这个代码,但看起来像)
function a()
{
let b: IOptions = {}
return b as IOptions
}
它会让我写这样的
function a(): IOptions
{
let b: IOptions = {}
return b
}
我想要一种可以在.d.ts中自动提取desc的方法