I have created file called global.d.ts in src folder with following content:
declare module 'ol-contextmenu';
I have also tried to locate it in root, in node-modules/@types but it just doesn't work.
My component imports ol-contextmenu (that doesn't have types) like this:
import ContextMenu from 'ol-contextmenu';
I have tried to edit tsconfig.json in multiple ways for the .d.ts file to be found. For example:
"include": [
"src/global.d.ts"
]
But I always get error:
error TS7016: Could not find a declaration file for module 'ol-contextmenu'. 'C:/dev/nis/NIS/ClientApp/node_modules/ol-contextmenu/dist/ol-contextmenu.js' implicitly has an 'any' type. Try
npm install @types/ol-contextmenuif it exists or add a new declaration (.d.ts) file containingdeclare module 'ol-contextmenu';5 import ContextMenu from 'ol-contextmenu'; ~~~~~~~~~~~~~~~~
I have also tried to copy the file to node-modules/@types but the error is always same.