Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import #65

Open
AAshSa opened this issue Aug 12, 2021 · 4 comments
Open

Can't import #65

AAshSa opened this issue Aug 12, 2021 · 4 comments

Comments

@AAshSa
Copy link

AAshSa commented Aug 12, 2021

Sorry, beginner in Angular here. I got dxf-parser to install types by running npm install dxf-parser-typings. But three-dxf shows this error after installing it:
Could not find a declaration file for module 'three-dxf'. .../ClientApp/node_modules/three-dxf/dist/three-dxf.js' implicitly has an 'any' type.
Try npm i --save-dev @types/three-dxf if it exists or add a new declaration (.d.ts) file containing declare module 'three-dxf';ts(7016)

I have tried running npm i --save-dev @types/three-dxf, npm install @types/three-dxf, and npm install three-dxf-typings and it shows this error in the console:
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/three-dxf-typings - Not found
npm ERR! 404
npm ERR! 404 'three-dxf-typings@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Please help :(

@bzuillsmith
Copy link
Member

No one has sat down and defined TypeScript definitions for the library. I believe that means you need to go the route of declare module 'three-dxf'; as it says in the error message there and you just won't get compile-time help. But I'm not entirely sure, it's been a while since I've had to use an untyped library in typescript.

@oubenruing
Copy link

Adding an index.d.ts file to the '/src' directory might solve this problem temporarily, which is what I did under my typescript project. This also does not give full compile-time help.

//index.d.ts
export declare class Viewer {
  constructor(data: any, parent: Element, width: number, height: number, font: any);
}

@AAshSa
Copy link
Author

AAshSa commented Sep 27, 2021

Adding an index.d.ts file to the '/src' directory might solve this problem temporarily, which is what I did under my typescript project. This also does not give full compile-time help.

//index.d.ts
export declare class Viewer {
  constructor(data: any, parent: Element, width: number, height: number, font: any);
}

I did end up creating my own typings file and it was able to call it okay, but like you mentioned then there were build issues which I was able to sort out some, but then some were caused by a mismatch of THREE.js since Geometry and Face3 are now depreciated and this uses that.

@bzuillsmith
Copy link
Member

then some were caused by a mismatch of THREE.js since Geometry and Face3 are now depreciated and this uses that.

The latest version resolves this issue. We no longer use Face3 and are compatible with the latest version of Three

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants