# @typescript/ata

> A dependency for downloading `*.d.ts` files corresponding to a Node.js source file. Relies on API's provided by [jsdelivr](https://www.jsdelivr.com).

Latest version **0.9.8** (published 2025-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typescript/ata
pnpm add @typescript/ata
yarn add @typescript/ata
bun add @typescript/ata
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.9.8 |
| Published | 2025-05-23 |
| First published | 2021-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 51.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2555 |
| Maintainers | typescript-bot, weswigham, sanders_n, andrewbranch, sheetalkamat, typescript-deploys, jakebailey |

## Links

- npm: https://www.npmjs.com/package/@typescript/ata
- Repository: https://github.com/microsoft/TypeScript-Website
- Issues: https://github.com/microsoft/TypeScript-Website/issues
- npm.io page: https://npm.io/package/@typescript/ata

## Recent versions

- 0.9.8 (latest) — 2025-05-23
- 0.9.7 — 2024-08-02
- 0.9.6 — 2024-06-05
- 0.9.5 — 2024-05-30
- 0.9.4 — 2023-07-25
- 0.9.3 — 2021-10-26
- 0.9.2 — 2021-10-21
- 0.9.0 — 2021-10-16
- 0.0.1 — 2021-10-13

## README

# TypeScript - Automatic Type Acquisition

A dependency for downloading `*.d.ts` files corresponding to a Node.js source file. Relies on API's provided by [jsdelivr](https://www.jsdelivr.com).

### Usage

```ts
// Create the function for running ATA with a series of callbacks
const ata = setupTypeAcquisition({
  projectName: "My ATA Project",
  typescript: ts,
  logger: console,
  delegate: {
    receivedFile: (code: string, path: string) => {
      // Add code to your runtime at the path...
    },
    started: () => {
      console.log("ATA start")
    },
    progress: (downloaded: number, total: number) => {
      console.log(`Got ${downloaded} out of ${total}`)
    },
    finished: vfs => {
      console.log("ATA done", vfs)
    },
  },
})

// Run that function with the new sourcefile
ata(`import danger from "danger"`)
```

You can call `ata` when it is convenient to you, it will not grab the same dependencies twice. The callbacks for `started` and `finished` are only triggered when some work is going to happen, so you can use those for UI elements show/hide. `progress` is triggered every 5 downloads.

### How it works

At a high level, for this input code:

```
import danger from "danger"
```

The library will

- Look for the latest npm module of "danger", then get its file list
- As there are `.d.ts` files to download in the dep, then it triggers `started`
- Download the `*.d.ts` files for "danger" from the npm module "danger"
- Read those `.d.ts` and look at these modules from usage:
  - `"node-fetch"` - it sees that "node-fetch" has no `.d.ts` files and gets them from "@types/node-fetch"
  - `"commander"` - it sees that command ships its own types
  - `"@octokit/rest"` - it sees that octokit/rest ships its own types
  - `"gitlab"` - it also sees
- Recurse though their dependencies too.
- Once those are done, trigger `finished` with a Map of the `vfs` if you prefer to set them in bulk.

### Niceties

Users can give a specific npm version or tag to work from instead of the default "latest":

```ts
import { xy } from "xyz" // types: beta
```

If this isn't something you want, I'm not against a flag to disable it.

---
_Source: https://npm.io/package/@typescript/ata · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
