Recently contacted Typescript, feeling very strong, but also have some problems.
For example, we normally write JS, as long as the other JS library into the page, and even as long as added to the project, ReSharper will automatically analyze him, and provide grammar can only sense, write code very comfortable.
However, since Typescript is a strongly typed language, he does not allow other unknown JS libraries to be used at the moment, because there is no way to do compile detection, so how to use other JS libraries in TS becomes a problem.
Here are a few ways to find out:
1. Use declare keyword
Declare var $: any; Declare var jquery:any;jquery (function() { $ ("<div>"). Text ("TypeScript"). AppendTo ($ (" Body "));})
His role is to declare that the variable already exists in some other JS, but also to lose all the compiler's grammar IntelliSense, grammar check and other functions.
It is a double-edged sword.
Other about declare keywords read:
Whats the difference between "declare class" and "interface" in TypeScript
http://blogs.microsoft.co.il/gilf/2013/07/22/quick-tip-typescript-declare-keyword/
2. Using TS definition files
(not to be continued)
Ways to use other JS frames or libraries in typescript