Forge Viewer 的 TypeScript 定义缺少 getFragmentProxy

TypeScript Definitions for Forge Viewer missing getFragmentProxy

我在下面的 link 中使用 Forge 的打字稿定义: https://forge.autodesk.com/blog/typescript-definitions-forge-viewer-and-nodejs-client-sdk-now-available

当我按照这篇文章尝试转换模型时: https://forge.autodesk.com/blog/know-how-complex-component-transformations-viewer-part-1-basics,我意识到 viewerimpl 缺少方法 getFragmentProxy

我该如何解决这个问题?

感谢您告知我们。此问题是由于社区为 DefinitelyTyped repository 下的 Forge Viewer(即 @types/forge-viewer)贡献的 TypeScript 定义文件中缺少 Viewer3DImpl#getFragmentProxy 的类型定义,因此 TypeScript 类型 checker/complier 找不到类型定义。该方法仍然存在于 Forge Viewer JavaScript 库中。要修复它,这里有一些建议供您参考:

  • 自己创建一个 PR 以在 DefinitelyTyped repository 上添加 Viewer3DImpl#getFragmentProxy 的缺失类型定义
  • 创建一个虚拟 .d.ts 文件以将缺少的类型定义添加到您的代码项目中的某处。 How-To (Link1 & )
  • 请参考这里
  • 等待我们更新@types/forge-viewer不推荐,一行代码更新可能需要一些时间)