# cosmiconfig-typescript-loader

> TypeScript loader for cosmiconfig

Latest version **6.3.0** (published 2026-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install cosmiconfig-typescript-loader
pnpm add cosmiconfig-typescript-loader
yarn add cosmiconfig-typescript-loader
bun add cosmiconfig-typescript-loader
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.3.0 |
| Published | 2026-04-09 |
| First published | 2021-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=v18 |
| Dependencies | 1 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 35 |
| Author | Alex Miller |
| Maintainers | codex- |
| Keywords | cosmiconfig, typescript |

## Links

- npm: https://www.npmjs.com/package/cosmiconfig-typescript-loader
- Repository: https://github.com/Codex-/cosmiconfig-typescript-loader
- Homepage: https://github.com/Codex-/cosmiconfig-typescript-loader#readme
- Issues: https://github.com/Codex-/cosmiconfig-typescript-loader/issues
- npm.io page: https://npm.io/package/cosmiconfig-typescript-loader

## Dependencies (1)

- [jiti](https://npm.io/package/jiti.md) 2.6.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 6.3.0 (latest) — 2026-04-09
- 6.2.0 — 2025-10-10
- 6.1.0 — 2024-12-05
- 6.0.0 — 2024-10-19
- 5.1.0 — 2024-10-19
- 5.0.0 — 2023-07-25
- 4.4.0 — 2023-07-25
- 4.3.0 — 2022-12-11
- 4.2.0 — 2022-10-31
- 4.1.1 — 2022-09-28
- 4.1.0 — 2022-09-15
- 4.0.0 — 2022-08-26
- 3.1.2 — 2022-08-26
- 3.1.1 — 2022-07-29
- 3.1.0 — 2022-07-29
- … 22 more at https://npm.io/package/cosmiconfig-typescript-loader/versions

## README

# cosmiconfig-typescript-loader

> ⚙️🚀 TypeScript config file support for cosmiconfig

[![build](https://github.com/Codex-/cosmiconfig-typescript-loader/actions/workflows/build.yml/badge.svg)](https://github.com/Codex-/cosmiconfig-typescript-loader/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/Codex-/cosmiconfig-typescript-loader/branch/main/graph/badge.svg?token=WWGNIPC249)](https://codecov.io/gh/Codex-/cosmiconfig-typescript-loader)
[![npm](https://img.shields.io/npm/v/cosmiconfig-typescript-loader.svg)](https://www.npmjs.com/package/cosmiconfig-typescript-loader)

## Usage

Simply add `TypeScriptLoader` to the list of loaders for the `.ts` file type, and `await` loading:

```ts
import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  searchPlaces: [
    "package.json",
    `.${moduleName}rc`,
    `.${moduleName}rc.json`,
    `.${moduleName}rc.yaml`,
    `.${moduleName}rc.yml`,
    `.${moduleName}rc.js`,
    `.${moduleName}rc.ts`,
    `.${moduleName}rc.cjs`,
    `${moduleName}.config.js`,
    `${moduleName}.config.ts`,
    `${moduleName}.config.cjs`,
  ],
  loaders: {
    ".ts": TypeScriptLoader(),
  },
});

const cfg = await explorer.load("./");
```

Or more simply if you only support loading of a TypeScript based configuration file:

```ts
import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  loaders: {
    ".ts": TypeScriptLoader(),
  },
});

const cfg = await explorer.load("./amazing.config.ts");
```

### Synchronously loading

With the release of Jiti 2, the synchronous loader has now been deprecated. It can still be used by using the `TypeScriptLoaderSync` export:

```ts
import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoaderSync } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  loaders: {
    ".ts": TypeScriptLoaderSync(),
  },
});

const cfg = explorer.load("./amazing.config.ts");
```

## `@endemolshinegroup/cosmiconfig-typescript-loader`

This package serves as a drop in replacement for `@endemolshinegroup/cosmiconfig-typescript-loader`. At the time of publishing this, `endemolshinegroup` is not maintaining the original package. I can only assume this is to do with the fact that Endemol Shine Group [was purchased and absorbed by another business](https://en.wikipedia.org/wiki/Endemol_Shine_Group#Sale_to_Banijay). This discontinuation of development efforts towards the original package left any open issues and pull requests unresolved.

This new package resolves the following original issues:

- [`#134`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/134): "Doesn't work with Cosmiconfig sync API"
- [`#147`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/147): "doesn't provide typescript, requested by ts-node"
- [`#155`](https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/issues/155): "Misleading TypeScriptCompileError when user's tsconfig.json "module" is set to "es2015""

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