Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a declaration file for module '@editorjs/image'

I am using editorjs in react project with typescript. I am using EditorJS and noticed missing declaration file for module '@editorjs/image'.

Upon importing I noticed the following warning/error,

'node_modules/@editorjs/image/dist/bundle.js' implicitly has an 'any' type.

along with a suggestion,

  Try `npm i --save-dev @types/editorjs__image` if it exists or add a new declaration (.d.ts) file containing `declare module '@editorjs/image';`ts(7016)

No quick fixes are available. The typescript types are missing for @editorjs/image. I created a .d.ts file in the project for @editorjs/image module with the following declaration code,

declare module "@editorjs/image"

but it is not referring to the editorjs/image package for the usage.

like image 734
ash Avatar asked Sep 20 '25 10:09

ash


1 Answers

The problem is that the .d.ts file you've created in the project should also be listed as a part of your project in your tsconfig.json:

  "include": [
    "**/*.ts",
    "**/*.tsx",
    "global.d.ts" // << specify your file here
  ],
like image 149
Kostiantyn Ko Avatar answered Sep 22 '25 01:09

Kostiantyn Ko