Demo mode — data resets on refresh.

Advanced TypeScript

Declaration Files

.d.ts Files

Declaration files (.d.ts) describe the types of existing JavaScript code. They let TypeScript understand libraries that weren't written in TypeScript.

DefinitelyTyped

The @types npm packages provide type declarations for thousands of popular JavaScript libraries. Installing @types/lodash gives TypeScript full knowledge of Lodash's API.

Writing Your Own

When a library has no @types package, you may need to write your own declaration file. Use declare module to tell TypeScript about the module.