TonyGermaneri / canvas-datagrid

Canvas based data grid web component. Capable of displaying millions of contiguous hierarchical rows and columns without paging or loading, on a single canvas element.
BSD 3-Clause "New" or "Revised" License
1.42k stars 184 forks source link

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

Open ug1989 opened 11 months ago

ug1989 commented 11 months ago
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 commented 8 months ago

+1

jeerbl commented 8 months ago

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 commented 8 months ago

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

McMalloc commented 5 months ago

Are there any updates?

kent-leow commented 3 months ago

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 commented 3 months ago

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