Typescript Definition Patterns | Typescript Tutorial | Tutorial 2021 | typescript
Channel: Programming Rise
Date: 2021-05-10

Typescript Definition Patterns | Typescript Tutorial | Tutorial 2021 | typescript | Applying Advanced TypeScript Definition Patterns

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. TypeScript is designed for the development of large applications and transcompiles to JavaScript.

Built-in Type Definitions

TypeScript includes declaration files for all of the standardized built-in APIs available in JavaScript runtimes. This includes things like methods and properties of built-in types like string or function, top-level names like Math and Object, and their associated types. By default, TypeScript also includes types for things available when running inside the browser, such as window and document; these are collectively referred to as the DOM APIs.

TypeScript names these declaration files with the pattern lib.[something].d.ts. If you navigate into a file with that name, you can know that you’re dealing with some built-in part of the platform, not user code.

https://www.typescriptlang.org/docs/handbook/2/type-declarations.html#built-in-type-definitions

External Definitions

For non-built-in APIs, there are a variety of ways you can get declaration files. How you do this depends on exactly which library you’re getting types for.

https://www.typescriptlang.org/docs/handbook/2/type-declarations.html#external-definitions

Speaker:  Ethan Arrowood

PUBLICATION PERMISSIONS:
The original video was published with the Creative Commons Attribution license (reuse allowed). Link:
https://youtu.be/WjJdJkkriyE