老项目迁移.有些库对Math进行了扩展,添加了add,sub等方法.用的地方太多,ts-ignore不够用啊
进行了的尝试
types/index.d.ts
export type MathExt = { add(number1: number, number2: number): number; // ... }; export declare var Math: Math & MathExt;
找到文档已解决根目录添加types/index.d.ts
declare global { interface Math { add(number1: number, number2: number): number; // ... } }
1.4m articles
1.4m replys
5 comments
57.0k users