老项目迁移.有些库对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; // ... } }
2.1m questions
2.1m answers
60 comments
57.0k users