constantin-p / cp-react-tree-table

A fast, efficient tree table component for ReactJS.
https://constantin.software/cp-react-tree-table
MIT License
94 stars 27 forks source link

Could not find a declaration file for module 'cp-react-tree-table'. #13

Closed jgeluk closed 5 years ago

jgeluk commented 5 years ago

Getting an error like:

Could not find a declaration file for module 'cp-react-tree-table'. './node_modules/cp-react-tree-table/dist/index.js' implicitly has an 'any' type.
  Try `npm install @types/cp-react-tree-table` if it exists or add a new declaration (.d.ts) file containing `declare module 'cp-react-tree-table';`ts(7016)

On the import statement (as copied from the example)

constantin-p commented 5 years ago

Hi @jgeluk,

From the error message, I assume that you are using the library in a TypeScript project. The current version (v0.x) is not using TypeScript for type-checking so the TypeScript compiler is not going to find any type definitions associated with the module.

You can solve the TypeScript error by creating a type declaration file cp-react-tree-table.d.ts with the following content:

declare module 'cp-react-tree-table';

NOTE: If you are interested in out of the box support for TypeScript, the next version (v1.0) is written in TypeScript and it is going to be released in a few weeks.

altavir commented 5 years ago

No d.ts yet. Even if the project is written in TypeScript.

constantin-p commented 5 years ago

You are right, @altavir. I'm going to change the build process to generate the definition files in the next few days.

altavir commented 5 years ago

OK, I've even painfully reproduced the build (Kotlin-JS, completely unfamiliar with JS/TS stack), but it gives type error.

constantin-p commented 5 years ago

Hi @altavir,

Commit d5ce84e3388b5ce42514efab348e1a3c9ecde3f1 (npm: 1.0.0-beta.6) should fix this issue by generating a declaration file at build time.

altavir commented 5 years ago

Thanks, I've already created manual bindings for kotlin, but I will check it later.