{"id":13327,"library":"indefinitely-typed","title":"indefinitely-typed","description":"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.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/danmarshall/indefinitely-typed","tags":["javascript","TypeScript","DefinitelyTyped"],"install":[{"cmd":"npm install indefinitely-typed","lang":"bash","label":"npm"},{"cmd":"yarn add indefinitely-typed","lang":"bash","label":"yarn"},{"cmd":"pnpm add indefinitely-typed","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import { indefinitelyTyped } from 'indefinitely-typed'","symbol":"indefinitely-typed (CLI Command)","correct":"\"postinstall\": \"indefinitely-typed --folder cool-package\""},{"note":"To manage types for multiple packages from a single typings package, specify each folder with a separate `--folder` argument in the CLI command.","symbol":"Multiple folders (CLI Command)","correct":"\"postinstall\": \"indefinitely-typed --folder folder1 --folder folder2\""}],"quickstart":{"code":"// First, create your typings package, e.g., 'my-awesome-lib-typings'\n// my-awesome-lib-typings/package.json\n{\n  \"name\": \"my-awesome-lib-typings\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"postinstall\": \"indefinitely-typed --folder my-awesome-lib\"\n  },\n  \"dependencies\": {\n    \"indefinitely-typed\": \"^1.1.0\"\n  }\n}\n\n// my-awesome-lib-typings/my-awesome-lib/index.d.ts\ndeclare module 'my-awesome-lib' {\n  export function initialize(config: { apiKey: string }): Promise<void>;\n  export class Client {\n    constructor(token: string);\n    fetchData(): { id: string; value: any }[];\n  }\n}\n\n// Then, in your main application:\n// In your-app/package.json, add:\n//   \"dependencies\": {\n//     \"my-awesome-lib-typings\": \"^1.0.0\",\n//     \"my-awesome-lib\": \"^1.0.0\" // Assuming the actual library is also a dependency\n//   }\n\n// After `npm install` in 'your-app', the types will be available:\n// your-app/src/main.ts\nimport { initialize, Client } from 'my-awesome-lib';\n\nasync function runApp() {\n  await initialize({ apiKey: process.env.MY_API_KEY ?? 'default_api_key' });\n  const client = new Client(\"my-secret-token\");\n  const data = client.fetchData();\n  console.log('Fetched data:', data);\n}\n\nrunApp();","lang":"typescript","description":"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."},"warnings":[{"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.","message":"Security risk with `postinstall` scripts","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Not suitable for high-quality, production-ready types","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Potential for type declaration conflicts or overwrites","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Types might not be resolved if `tsconfig.json` is misconfigured","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"The `indefinitely-typed` package is not installed as a direct dependency or is not found in the PATH for the `postinstall` script.","error":"indefinitely-typed: command not found"},{"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.","cause":"TypeScript cannot resolve the type declarations. This could be due to an incorrect folder name argument, `tsconfig.json` misconfiguration, or stale `node_modules` cache.","error":"Cannot find module 'my-awesome-lib' or Cannot find name 'Client'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}