dotoritos-kim / dxf-json

perfect dxf parser
GNU General Public License v3.0
56 stars 3 forks source link

Could not find a declaration file. #12

Closed rajbirjohar closed 2 months ago

rajbirjohar commented 6 months ago

Describe the bug Received this error when trying to import DxfParser.

Could not find a declaration file for module 'dxf-json'. '/Users/rajbirjohar/Projects/oxygen/oxygen-ui/node_modules/.pnpm/dxf-json@0.0.41/node_modules/dxf-json/dist/bundle.mjs' implicitly has an 'any' type.
  There are types at '/Users/rajbirjohar/Projects/oxygen/oxygen-ui/node_modules/dxf-json/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'dxf-json' library may need to update its package.json or typings.

Seems like the types are not being created correctly.

To Reproduce Steps to reproduce the behavior:

  1. Create a new react project.
  2. Install dxf-json.
  3. Import DxfParser.

Expected behavior The types should be resolved correctly.

Desktop (please complete the following information):

Additional context On a side note, would this help me render the json as a threeJS object?

Edit: Workaround found:

Add this to your tsconfig

 "paths": {
      "@/*": ["./src/*"],
      "dxf-json": ["./node_modules/dxf-json/dist/index.d.ts"]
    }
dotoritos-kim commented 6 months ago

Since this issue is so extensive, all I can say is to try various things.

On a side note, would this help me render the json as a threeJS object? -> Although it does not provide direct help to three.js, it can at least help process data easily by converting it to json. And it feels compatible with that repository.

https://github.com/vagran/dxf-viewer

dotoritos-kim commented 2 months ago

Released in version 0.1.1.