Member-only story

Learning TypeScript 06 — Declaration files

Quique Fdez. Guerra
3 min readSep 11, 2018

--

At this point, we have talked about a lot of different things related to TypeScript.

But now, we need to understand how to be able to work with JavaScript libraries with our TypeScript code.

And that is really easy thanks to the ‘declaration files’ because these files tell to TypeScripthow the libraries are made and how are their structures.

But can I work without declaration files?

Sure, you can. This is an example of a code that is loading an external library.

In the most of the cases if you load the library like import * as NAME from 'path' it will work but are not going to be able to know anything from the library.

If you have problems you can try something like this.

But yes, this is ugly.

Working with declaration files

--

--

Quique Fdez. Guerra
Quique Fdez. Guerra

Written by Quique Fdez. Guerra

Director of Engineering at @PlainConcepts Romania Frontend Developer Lazy @Github contributor Happy @Helpdev_ founder Web @GoogleDevExpert

No responses yet