O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding types

TypeScript needs to span across other JavaScript libraries too if we want to efficiently and globally use TypeScript. TypeScript uses the .d.ts files to provide types of JavaScript libraries that were not written in ES6 or TypeScript. Once the .d.ts file is defined, it becomes very easy to see the return types and provide easy type checking. The TypeScript community is very active and it provides types for most files: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types.

Revisiting our tsconfig.json file, we have specified the option noImplicitAny: true and we need a mandatory *.d.ts file for any of the libraries we use. If we set that option to false, tsc will not give any errors, but that's not a recommended ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required