Skip to content

TypeScript Definition Helper for not type-defined package in DefinitelyTyped to use easily

Notifications You must be signed in to change notification settings

tamayika/types-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version CircleCI

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.

Usage

> 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.

Command Options

shorthand full description
-v --version Show version
-h --help Show help

types-local.json

types-local.json allows you to customize types-local behavior.

> types-local init

creates types-local.json with default setting.

Options

name type default description
installDir string types-local types definition location directory

Module Resolution

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.

About

TypeScript Definition Helper for not type-defined package in DefinitelyTyped to use easily

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published