打字稿编译器错误 TS2307:找不到模块“jquery" [英] Typescript Compiler error TS2307: Cannot find module 'jquery'
问题描述
我正在关注 JSPM 入门 guide 并且我想安装 jquery 包,所以我执行下面的命令.
I was following JSPM getting started guide and I want to install jquery package so I execute below command.
jspm 安装 jquery
但是当我尝试在像下面这样的打字稿中导入它时
But when I try to import it in typescript like below
从'jquery'导入$
我收到来自打字稿编译器的错误消息,说 error TS2307: 找不到模块 'jquery'.
不仅对于其他库的这个库,我也遇到了同样的错误.
I'm getting a error from typescript compiler saying error TS2307: Cannot find module 'jquery'.
Not only for this library for other libraries I'm getting the same error.
推荐答案
你需要在编译上下文中包含 jquery
的类型定义,你可以从 https://github.com/DefinitelyTyped/DefinitelyTyped
You need to include type definitions for jquery
in the compilation context, you can grab them from https://github.com/DefinitelyTyped/DefinitelyTyped
这篇关于打字稿编译器错误 TS2307:找不到模块“jquery"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!