在您的package.json中安装缺少的TypeScript类型以用于依赖关系
在您的package.json中安装缺少的TypeScript类型以用于依赖关系
JavaScript CSS相关
共968Star
详细介绍
typesync
Install missing TypeScript typings for dependencies in your package.json
.
Install
npm install -g typesync
You can also use it directly with npx
which will install it for you:
npx typesync
Usage
typesync [path/to/package.json] [--dry]
Path is relative to the current working directory. If omitted, defaults to package.json
.
--dry
If --dry
is specified, will not actually write to the file, it only prints added typings,
--ignoredeps
To ignore certain sections, you can use the --ignoredeps=
flag. For example, to ignore devDependencies
, use --ignoredeps=dev
. To ignore multiple, comma-separate them, like this: --ignoredeps=deps,peer
(ignores dependencies
and peerDependencies
).
--ignoredeps=deps
— ignoresdependencies
--ignoredeps=dev
— ignoresdevDependencies
--ignoredeps=peer
— ignorespeerDependencies
--ignoredeps=optional
— ignoresoptionalDependencies
Note: typesync
only modifies your package.json
- you still need to run npm install
, or — if drinking the k00laid — yarn
.
Typings packages
TypeSync will add typings for packages that:
- have a
@types/package
available - don't already provide typings internally (the
typings
andtypes
field inpackage.json
)
TypeSync will try to respect semver parity for the code and typings packages, and will fall back to the latest available typings package.
If you use a Semver ^
or ~
for a package, the same prefix will be used for the typings package. If you pin to an exact version ("some-package": "1.2.3"
), no prefix will be written.
If a typings package in your package.json
is not used (has no corresponding code package in your package.json
and does not contribute to the global namespace), TypeSync will automatically remove it.
Monorepos
TypeSync added support for monorepos in v0.4.0. It will look at packages
/workspaces
globs in package.json
and sync every matching file in one fell swoop.
Why?
Installing typings manually sucks. Flow has flow-typed
which installs type definitions by looking at a package.json
, which would be cool to have for TypeScript. Now we do!
Changelog
See CHANGELOG.md
Author
Jeff Hansen - @Jeffijoe
-
569 Star
-
1185 Star
-
1520 Star
-
85 Star
-
83 Star
-
0 Star
-
352 Star
-
0 Star