Registry / type-stubs / indefinitely-typed

indefinitely-typed

JSON →
library1.1.0jsnpmunverified

indefinitely-typed is a utility designed to manage pre-release or experimental TypeScript declaration files, offering a flexible alternative to the more stringent publishing process of DefinitelyTyped. Currently at version 1.1.0, this package provides a mechanism to locally install and make custom type definitions available by copying specified folders into the `node_modules/@types/` directory of a consuming project. This allows developers to iterate quickly on type definitions, support custom versioning, or publish types on demand without waiting for the `types-publisher` process. Its primary use case is for types that are 'hatching' – incomplete, lacking comprehensive tests, or requiring a rapid deployment cycle not typically supported by the official `@types` ecosystem. It is primarily invoked as a `postinstall` script, making the types immediately available upon package installation.

npm install indefinitely-typed
INSTALL
IMPORT
SIG · INDEFINITELY-TYPED
I
indefinitely-typed
type-stubsjavascriptv1.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

indefinitely-typed (CLI Command)
"postinstall": "indefinitely-typed --folder cool-package"
import { indefinitelyTyped } from 'indefinitely-typed'
This package is a command-line interface (CLI) tool executed within `package.json` scripts, typically `postinstall`. It is not designed for direct programmatic import or use within JavaScript/TypeScript application code.
Multiple folders (CLI Command)
"postinstall": "indefinitely-typed --folder folder1 --folder folder2"
To manage types for multiple packages from a single typings package, specify each folder with a separate `--folder` argument in the CLI command.

This quickstart demonstrates how to create a typings package using `indefinitely-typed` and consume it in another project, making custom type declarations available via a `postinstall` script.

// First, create your typings package, e.g., 'my-awesome-lib-typings' // my-awesome-lib-typings/package.json { "name": "my-awesome-lib-typings", "version": "1.0.0", "scripts": { "postinstall": "indefinitely-typed --folder my-awesome-lib" }, "dependencies": { "indefinitely-typed": "^1.1.0" } } // my-awesome-lib-typings/my-awesome-lib/index.d.ts declare module 'my-awesome-lib' { export function initialize(config: { apiKey: string }): Promise<void>; export class Client { constructor(token: string); fetchData(): { id: string; value: any }[]; } } // Then, in your main application: // In your-app/package.json, add: // "dependencies": { // "my-awesome-lib-typings": "^1.0.0", // "my-awesome-lib": "^1.0.0" // Assuming the actual library is also a dependency // } // After `npm install` in 'your-app', the types will be available: // your-app/src/main.ts import { initialize, Client } from 'my-awesome-lib'; async function runApp() { await initialize({ apiKey: process.env.MY_API_KEY ?? 'default_api_key' }); const client = new Client("my-secret-token"); const data = client.fetchData(); console.log('Fetched data:', data); } runApp();
Debug
Known issues
gotchaSecurity risk with `postinstall` scripts
fix
Exercise caution when installing packages that utilize `postinstall` scripts, especially from untrusted sources, as they can execute arbitrary code on your system. Always review the `postinstall` script in `package.json` before installation if you are unsure about the package's origin.
affects: >=1.0.0
gotchaNot suitable for high-quality, production-ready types
fix
`indefinitely-typed` is designed for 'hatching' types. For stable, well-tested, and widely used type definitions, contribute to or consume from DefinitelyTyped (`@types/`). This tool bypasses the quality assurance processes of DefinitelyTyped.
affects: >=1.0.0
gotchaPotential for type declaration conflicts or overwrites
fix
Ensure that the type package name (`my-awesome-lib` in the example) does not conflict with existing `@types/` packages or official type declarations shipped directly with a library. `indefinitely-typed` will copy its declarations into `node_modules/@types/`, potentially shadowing or overwriting others.
affects: >=1.0.0
gotchaTypes might not be resolved if `tsconfig.json` is misconfigured
fix
Ensure your `tsconfig.json` does not explicitly exclude `node_modules/@types` or use `typeRoots` in a way that prevents discovery. The default TypeScript module resolution usually finds types in this location, but custom configurations can interfere.
affects: >=1.0.0
Errors
Common errors & fixes
indefinitely-typed: command not found
The `indefinitely-typed` package is not installed as a direct dependency or is not found in the PATH for the `postinstall` script.
fix
Ensure `indefinitely-typed` is listed in `devDependencies` or `dependencies` in the `package.json` where the `postinstall` script is defined, and that `npm install` has been run to link the executable.
Cannot find module 'my-awesome-lib' or Cannot find name 'Client'
TypeScript cannot resolve the type declarations. This could be due to an incorrect folder name argument, `tsconfig.json` misconfiguration, or stale `node_modules` cache.
fix
Verify that the `--folder` argument in the `postinstall` script exactly matches the name of the package you're providing types for (e.g., `my-awesome-lib`). Check `tsconfig.json` for `typeRoots` or `types` configurations. Try deleting `node_modules` and `package-lock.json` (or `yarn.lock`), then run `npm install` again.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
36
Amazon
1
OpenAI (training)
1
Resources
indefinitely-typed — npm install indefinitely-typed · libregistry