全局 type 类型的寻找 typescript 类型 - fabric.Canvas

全局 type类型的寻找 typescript 类型 - fabric.Canvas

declare type ExtCanvas = fabric.Canvas & {
  isDragging: boolean;
  lastPosX: number;
  lastPosY: number;
};

这个代码 没有定义 fabric.Canvas,然后看看提示

说在namespace定义了。这个是子项目,没有type定义,上父项目寻找

在父项目中找到了,全局定义
这个定义的引入是在

父项目的tsconfig.josn 里面的 include数组的 "typings/**/*.ts", 设置的。

posted @ 2024-06-06 11:57  彭成刚  阅读(6)  评论(0编辑  收藏  举报