审查这份生成的本地声明与使用方包装函数。
为一个使用命名导出的JavaScript包补充类型;findCharge可能返回undefined,并且公开收据不得包含内部access token。
TypeScript
declare module "legacy-payments" {
interface Charge {
id: string;
cents: number;
accessToken: string;
}
function findCharge(id: string): Charge;
const client: { findCharge: typeof findCharge };
export default client;
}
import client from "legacy-payments";
type PublicReceipt = { id: string; cents: number };
export function publicReceipt(id: string) {
const charge = client.findCharge(id);
return charge;
}
生成代码仅作示例,不代表任何特定模型