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

File '/web-app/node_modules/canvas-datagrid/dist/types.d.ts' is not a module. #567

Open
ug1989 opened this issue Sep 30, 2023 · 6 comments

Comments

@ug1989
Copy link

ug1989 commented Sep 30, 2023

image

Expected behavior and actual behavior.

typescript project can read types correctly

Steps to reproduce the problem.

In any ts project, yarn add canvas-datagrid && import canvasDatagrid from 'canvas-datagrid' show the error

Specifications like the version of the project, operating system, or hardware.

--

The way I tried locally

When I edit node_modules/canvas-datagrid/dist/types.d.ts file with add export = canvasDatagrid;, vscode can read the type definition correctly

@jeerbl
Copy link

jeerbl commented Jan 4, 2024

+1

@jeerbl
Copy link

jeerbl commented Jan 4, 2024

Hi @TonyGermaneri, I love the module but just like @ug1989 I can't seem to import it in my project because of a typing issue.

@ndrsn
Copy link
Collaborator

ndrsn commented Jan 4, 2024

Hi, apologies for not responding sooner — I'll look into this tomorrow

@McMalloc
Copy link

McMalloc commented Apr 2, 2024

Are there any updates?

@kent-leow
Copy link

kent-leow commented Jun 6, 2024

For temporary solution:

  1. Create a file for module declaration canvas-datagrid.d.ts with
    declare module 'canvas-datagrid';
  2. Add it into your tsconfig.json
    { "compilerOptions: ..., "include": [ "path/to/canvas-datagrid.d.ts" ], }
  3. Use it in your code
    import canvasDatagrid from 'canvas-datagrid';

@TonyGermaneri
Copy link
Owner

Sorry for being so inattentive. Life can suck you away from projects you love. Thanks for the temp solution @kent-leow

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

No branches or pull requests

6 participants