Currently, I am facing an issue with importing jQuery into my TypeScript project.
In order to achieve this, I executed the command tsd install jquery --save
, which generated a jquery.d.ts file and added
/// <reference path="jquery/jquery.d.ts" />
to my tsd.d.ts file.
However, upon adding import * as $ from 'jquery';
at the beginning of my file, I encountered 77 compile errors within the jquery.d.ts file. All these errors mention: cannot find name "document". Additionally, it also fails to locate other key elements like Element, Event, Node, HtmlElement, XmlDocument, Text, and XMLHttpRequest.
You can view a few examples in the screenshot below:
https://i.stack.imgur.com/SfGHY.png
If anyone has any suggestions or insights on how to resolve this issue, please feel free to share. Your help would be greatly appreciated!