Is there a TypeScript equivalent to the flow-typed CLI tool?
Asked Answered
M

1

7

flow-typed is a CLI tool that provides auto-discovery of flow type definitions for installed JS packages (and other things).

I usually use TypeScript over Flow and often find myself installing packages like this:

yarn add lodash express bluebird
yarn add --dev @types/lodash @types/express @types/bluebird

I recently stumbled on to flow-typed and its install command, which checks the installed packages and automatically installs the type definitions for them, as required.

With flow-typed I would simply do:

yarn add lodash express bluebird
flow-typed install

Does an equivalent tool exist for TypeScript?

Mazer answered 11/10, 2020 at 20:3 Comment(2)
it's a little old, but you might try ts-typiePredictory
There's also github.com/jeffijoe/typesyncPrecaution
M
1

If using the legacy version of yarn (v1) - which is still very common - I have found no solution.

However, modern yarn (v2+) supports a plugin infrastructure and just such a plugin exists: the plugin-typescript.

This plugin offers a range of features, one being "Automatically adds @types/ packages into your dependencies when you add a package that doesn't include its own types".

Mazer answered 13/6, 2023 at 23:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.