javascript - Cannot import third party lib (CodeMirror) in main.ts (but works everywhere else) -


i'm trying use codemirror in typescript project , i've installed @types with:

npm install --save @types/codemirror

and seems working correctly classes (which inside ./source/entities/<classes>) can see method , class auto-completion , suggestions. it's correctly working in interfaces (in ./source/interfaces/<interfaces>).

now i'm trying import , use codemirror inside main.ts file, in ./source dir. however, i'm getting following error:

error: cannot find module 'codemirror' '/users/<my_user>/documents/<project>/source' 

i've tried importing codemirror in main.ts following statement:

import * codemirror "codemirror"; , import * codemirror "../node_modules/@types/codemirror"; neither seems work.

i've tried adding "types": [node] in tsconfig.json didn't work either.

i've built project using template found on github (it's first time using typescript , js): template vs code

from error message seems solution move codemirror ./source? i'd rather not since it's third party lib.

thanks

edit: hovering cursor on top of "codemirror": bit of import statement seems indicate correct path of @types codemirror dir:

module "/users/<my_user>/documents/<project>/node_modules/@types/codemirror/index"

edit 2: adding /// <reference path="../node_modules/@types/codemirror/index.d.ts" /> not seem help

edit 3: forgot add i've got source codemirror in third_party dir child of project root dir.


Comments