{"id":16528540,"url":"https://github.com/danvk/dtsearch","last_synced_at":"2025-09-12T19:31:39.511Z","repository":{"id":42231925,"uuid":"251129465","full_name":"danvk/dtsearch","owner":"danvk","description":"Find packages with TypeScript types, either bundled or on Definitely Typed","archived":false,"fork":false,"pushed_at":"2023-05-10T14:40:53.000Z","size":8377,"stargazers_count":24,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T23:03:59.091Z","etag":null,"topics":["cli","definitelytyped","npm","types","typescript","yarn"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danvk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-29T20:39:16.000Z","updated_at":"2024-11-11T14:02:10.000Z","dependencies_parsed_at":"2024-10-28T10:16:14.366Z","dependency_job_id":"a94ca161-38ea-44a9-af18-35b4d99bbda9","html_url":"https://github.com/danvk/dtsearch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fdtsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fdtsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fdtsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fdtsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvk","download_url":"https://codeload.github.com/danvk/dtsearch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232780148,"owners_count":18575474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","definitelytyped","npm","types","typescript","yarn"],"created_at":"2024-10-11T17:40:47.013Z","updated_at":"2025-01-06T19:58:59.324Z","avatar_url":"https://github.com/danvk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dtsearch\n\nFind npm packages that have type declarations, either bundled or on [DefinitelyTyped].\n\nUsage with `npx`:\n\n```\n$ npx dtsearch sprintf\n   DLS NAME              TYPES             DESCRIPTION\n533.3k sprintf           @types/sprintf    sprintf() for node.js\n 47.4m sprintf-js        @types/sprintf-js JavaScript sprintf implementation\n 82.9m extsprintf        @types/extsprintf extended POSIX-style sprintf\n  2.1m ssf               \u003cbundled\u003e         Format data using ECMA-376 spreadsheet Format Codes\n  1.6m printj            \u003cbundled\u003e         Pure-JS printf\n  123k voca              @types/voca       The ultimate JavaScript string library\n746.4k printf            \u003cbundled\u003e         Full implementation of the `printf` family in pure JS.\n  1.5k sprintfjs         \u003cbundled\u003e         POSIX sprintf(3)-style String Formatting for JavaScript\n   169 @jitesoft/sprintf \u003cbundled\u003e         sprintf function for javascript.\n    94 stringd           \u003cbundled\u003e         A string variable parser for JavaScript\n```\n\nAlternatively, you can install `dtsearch` globally using either:\n\n    npm install --global dtsearch\n    yarn global add dtsearch\n\nYou can use `--yarn` or `--npm` to produce copy/pastable commands to depend on packages _and_ their types:\n\n![Demonstration of search for a library and installing it using yarn](demo.gif)\n\n## Background\n\nThere are two ways to distribute TypeScript types for a package on npm:\n\n1. With the package itself (\"bundled\" or \"included\"). This is common if the package is written in TypeScript, or if the owner is committed to maintaining its type declarations. The tell-tale sign of bundled types is a `typings` entry in `package.json`.\n2. As a separate `@types` package on [DefinitelyTyped]. This is more common for packages which are written in plain JavaScript or another language. The type declarations are often written by someone other than the package author.\n\nBoth approaches are common and there are many tradeoffs between them.\n\nAs a TypeScript user, you'll often find yourself wanting to search for a package that does X and has type declarations (of either form). The usual approach is to search for packages and then check if they have type declarations ([yarnpkg] has recently added TypeScript badges which help with this).\n\nOnce you've found a package, you need to run different commands depending on whether it bundles its types or gets them from DefinitelyTyped. For example, using `yarn` and [`moment`][moment]:\n\n    yarn add moment  # bundled types\n\n    # Types on DefinitelyTyped\n    yarn add moment-timezone\n    yarn add -D @types/moment-timzeone\n\n`dtsearch` aims to solve these problems with a fast, simple CLI. It lets you search only packages with types and shows you the exact commands you need to run to add them to your project.\n\n## How this works\n\nThis uses Algolia's [npm search][2], the same search that you find on [yarnpkg].\n\n## Options\n\n- `-n`, `--num \u003cnumber\u003e` Maximum number of results to show (default: 10)\n- `--npm` Output `npm install` commands\n- `-y`, `--yarn` Output yarn add commands\n- `--bundled` Only show packages with bundled types\n- `--dt` Only show packages with types on DefinitelyTyped (@types)\n- `-u`, `--untyped` Search all packages, even those without type declarations.\n- `--repo` Show repo URLs, even if package specifies a homepage\n- `--stars` Show GitHub star counts. This is a useful quality signal but it does slow `dtsearch` down, so it is off by default.\n- `--debug` Enable debug logging\n\n## Development\n\nRun `tsc --watch` in the background to iterate:\n\n    yarn\n    yarn tsc --watch \u0026\n    ./bin/dtsearch --debug args\n\nTo publish a new version:\n\n    yarn tsc\n    npm publish\n\n## Related Work\n\n- The old [`typings search`](https://yarnpkg.com/package/typings) command from c. 2016 (before `@types`).\n- Microsoft's [TypeSearch](https://microsoft.github.io/TypeSearch/). Unfortunately this only searches DefinitelyTyped and only searches package names. It does not search bundled types or package descriptions.\n- [yarnpkg]'s search. This shows small \"TS\" icons next to packages with type declarations, either bundled or on DT. It does not surface a filter to search only packages with type declarations, however.\n- [pikapkg] lets you search packages with a [`has:types`][pikasearch] filter. This only searches bundled typings; it does not consider types on DT.\n- The yarn [TypesScript plugin][yarn-ts] automatically installs `@types` when you `yarn add` a package that has them.\n\n## Support\n\n\u003cimg src=\"https://effectivetypescript.com/images/cover.jpg\" height=\"100\" align=\"left\"\u003eIf you like this tool, consider buying a copy of my book, [_Effective TypeScript_][ets]. [Chapter 6] and particularly Item 46 (\"Understand the Three Versions Involved in Type Declarations\") are all about the trials and tribulations of getting TypeScript types for your dependencies. And it's got a bird on the cover!\n\n[DefinitelyTyped]: https://github.com/DefinitelyTyped/DefinitelyTyped\n[2]: https://discourse.algolia.com/t/2016-algolia-community-gift-yarn-package-search/319\n[moment]: https://momentjs.com/\n[yarnpkg]: https://yarnpkg.com/\n[pikapkg]: https://www.pika.dev/\n[pikasearch]: https://www.pika.dev/search?q=has%3Atypes%20moment\n[ets]: https://effectivetypescript.com/\n[Chapter 6]: https://effectivetypescript.com/#Chapter-6-Types-Declarations-and-types\n[yarn-ts]: https://github.com/yarnpkg/berry/tree/master/packages/plugin-typescript","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Fdtsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvk%2Fdtsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Fdtsearch/lists"}