diff --git a/types/npm-cache-filename/index.d.ts b/types/npm-cache-filename/index.d.ts new file mode 100644 index 0000000000..7d06a51722 --- /dev/null +++ b/types/npm-cache-filename/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for npm-cache-filename 1.0 +// Project: https://github.com/npm/npm-cache-filename +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function cf(root: string): (url: string) => string; +declare function cf(root: string, url: string): string; + +export = cf; diff --git a/types/npm-cache-filename/npm-cache-filename-tests.ts b/types/npm-cache-filename/npm-cache-filename-tests.ts new file mode 100644 index 0000000000..1b45a896f8 --- /dev/null +++ b/types/npm-cache-filename/npm-cache-filename-tests.ts @@ -0,0 +1,6 @@ +import cf = require('npm-cache-filename'); + +cf('/tmp/cache', 'https://registry.npmjs.org:1234/foo/bar'); // $ExpectType string + +const getFile = cf('/tmp/cache'); +getFile('https://registry.npmjs.org:1234/foo/bar'); // $ExpectType string diff --git a/types/npm-cache-filename/tsconfig.json b/types/npm-cache-filename/tsconfig.json new file mode 100644 index 0000000000..130b16249c --- /dev/null +++ b/types/npm-cache-filename/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "npm-cache-filename-tests.ts" + ] +} diff --git a/types/npm-cache-filename/tslint.json b/types/npm-cache-filename/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-cache-filename/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }