Typescript and JQuery compile error: Cannot find name '$'

前端 未结 5 2099
醉梦人生
醉梦人生 2021-02-05 03:13

I\'m testing typescript with jquery, but when I compile the test.ts file, it always gives me an error indicating: Cannot find name \'$\'.

I\'ve already imported jquery &

5条回答
  •  梦谈多话
    2021-02-05 04:05

    import * as $ from "jquery";
    

    didn't work for me. Interesting enough,

    import { ajax, css } from "jquery";
    

    actually solved my problem.

提交回复
热议问题