diff --git a/index.d.ts b/index.d.ts index 6e6a1e70..66f6ffd2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -declare module NpmCheck { +declare module "npm-check" { interface INpmCheckOptions { global?: boolean; update?: boolean; @@ -10,9 +10,22 @@ declare module NpmCheck { currentState?: Object; } - type INpmCheckGetSetValues = "packages" | "debug" | "global" | "cwd" | "cwdPackageJson" | "emoji"; + type INpmCheckGetSetValues = + | "packages" + | "debug" + | "global" + | "cwd" + | "cwdPackageJson" + | "emoji"; - type INpmVersionBumpType = "patch" | "minor" | "major" | "prerelease" | "build" | "nonSemver" | null; + type INpmVersionBumpType = + | "patch" + | "minor" + | "major" + | "prerelease" + | "build" + | "nonSemver" + | null; interface INpmCheckCurrentState { get: (key: INpmCheckGetSetValues) => INpmCheckPackage[]; @@ -20,32 +33,93 @@ declare module NpmCheck { } interface INpmCheckPackage { - moduleName: string; // name of the module. - homepage: string; // url to the home page. - regError: any; // error communicating with the registry - pkgError: any; // error reading the package.json - latest: string; // latest according to the registry. - installed: string; // version installed - isInstalled: boolean; // Is it installed? - notInstalled: boolean; // Is it installed? - packageWanted: string; // Requested version from the package.json. - packageJson: string; // Version or range requested in the parent package.json. - devDependency: boolean; // Is this a devDependency? - usedInScripts: undefined | string[], // Array of `scripts` in package.json that use this module. - mismatch: boolean; // Does the version installed not match the range in package.json? - semverValid: string; // Is the installed version valid semver? - easyUpgrade: boolean; // Will running just `npm install` upgrade the module? - bump: INpmVersionBumpType; // What kind of bump is required to get the latest - unused: boolean; // Is this module used in the code? + /** + * name of the module. + */ + moduleName: string; + + /** + * url to the home page. + */ + homepage: string; + + /** + * error communicating with the registry + */ + regError: any; + + /** + * error reading the package.json + */ + pkgError: any; + + /** + * latest according to the registry. + */ + latest: string; + + /** + * version installed + */ + installed: string; + + /** + * Is it installed? + */ + isInstalled: boolean; + /** + * Is it installed? + */ + notInstalled: boolean; + + /** + * Requested version from the package.json. + */ + packageWanted: string; + + /** + * Version or range requested in the parent package.json. + */ + packageJson: string; + + /** + * Is this a devDependency? + */ + devDependency: boolean; + + /** + * Array of `scripts` in package.json that use this module. + */ + usedInScripts: undefined | string[]; + + /** + * Does the version installed not match the range in package.json? + */ + mismatch: boolean; + + /** + * Is the installed version valid semver? + */ + semverValid: string; + + /** + * Will running just `npm install` upgrade the module? + */ + easyUpgrade: boolean; + + /** + * What kind of bump is required to get the latest + */ + bump: INpmVersionBumpType; + + /** + * Is this module used in the code? + */ + unused: boolean; } //The default function returns a promise - export default function(options: INpmCheckOptions): { + export default function (options: INpmCheckOptions): { then(stateFn: (state: INpmCheckCurrentState) => void): void; }; - } - -declare module "npm-check" { - export = NpmCheck.default; -} \ No newline at end of file diff --git a/package.json b/package.json index dd23834b..7ca15f90 100755 --- a/package.json +++ b/package.json @@ -62,7 +62,8 @@ "files": [ "bin", "lib", - "lib-es5" + "lib-es5", + "index.d.ts" ], "dependencies": { "callsite-record": "^4.1.4",