# declaration file

CEFR C1 · Compound

Source: https://englishreference.com/word/declaration-file
Updated: 2026-07-22

## Definition

a special computer file in programming that explains what code exists in another place. It tells the computer what names and types of data to expect so that it can catch mistakes early.

For teachers: a source file, typically with a .d.ts extension in TypeScript, that provides type information for existing JavaScript code. It describes the shape of an API or library without containing the actual implementation logic.

## Examples

- The developer added a declaration file to fix the type errors.
- When using a third-party library that lacks built-in types, you often need to install a separate declaration file to enable autocompletion in your editor.
- By maintaining a precise declaration file, the team ensured that any breaking changes in the underlying module would be immediately flagged by the compiler during the build process.

## Usage notes

- Commonly used in the context of TypeScript and C++ development; often referred to as a 'header file' in other languages.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
