I am new to typeScript and I want to be able to use a 3rd party library that does not have definition file. Does typescript allow you to use the external libraries?
<
Out of the pragmatic but perhaps not quite kosher categoy, a less elegant and non-TypeScript approach would be to simply declare but not assign the variable/function you want to use with TypeScript. This does not give you Intellisense, but it does allow you to very quickly use the library without creating any declarations or roll your own d.ts file.
For instance, here's an Angular example to provide OidcTokenManager as a constant on an app.core module:
((): void => {
angular
.module('app.core')
.constant('OidcTokenManager', OidcTokenManager);
})();
This will generate a TS2304 - Cannot find name 'OidcTokenManager' TypeScript error.
However, by simply declaring OidcTokenManager as of type any, TypeScript will let you pass:
((): void => {
let OidcTokenManager: any;
angular
.module('app.core')
.constant('OidcTokenManager', OidcTokenManager);
})();