types-local: A TypeScript Definition Helper for not type-defined package in DefinitelyTyped to use easily
types-local
is a tool that generates TypeScript definition file (.d.ts) from node package.
types-local
uses dts-gen, generates module at types-local/<module-name>
and install folder as package.
> npm install -g types-local
# install not type-defined package
> npm install --save <module-name>, <module-name2>, ...
> types-local install <module-name>, <module-name2>, ...
This generates
.
+-- types-local
+-- <module-name>
+-- package.json
+-- index.d.ts (type definition)
+-- <module-name2>
+-- package.json
+-- index.d.ts (type definition)
...
And update tsconfig.json
{
"compilerOptions": {
"baseUrl": ".", // if not exists
"paths": { // add module path
"${moduleName}": [
"types-local/${moduleName}"
],
"${moduleName2}": [
"types-local/${moduleName2}"
],
...
}
}
}
# if you want to uninstall definition
> types-local uninstall <module-name>, <module-name2>, ...
will remove types-local/<module-name>
, types-local/<module-name2>
, ... and update tsconfig.json
.
shorthand | full | description |
---|---|---|
-v | --version | Show version |
-h | --help | Show help |
types-local.json
allows you to customize types-local behavior.
> types-local init
creates types-local.json
with default setting.
name | type | default | description |
---|---|---|---|
installDir | string | types-local | types definition location directory |
Currently find node_modules
directory from current directory to root directory.
If node_modules/${moduleName}/package.json
is found, requires node_modules/${moduleName}
.
If not found, require(${moduleName})
calls.