Add types for npm-cache-filename (#37866)

This commit is contained in:
Florian Keller 2019-09-11 20:14:37 +02:00 committed by Sheetal Nandi
parent 2ab45d486e
commit 37f050d65d
4 changed files with 39 additions and 0 deletions

9
types/npm-cache-filename/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for npm-cache-filename 1.0
// Project: https://github.com/npm/npm-cache-filename
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function cf(root: string): (url: string) => string;
declare function cf(root: string, url: string): string;
export = cf;

View File

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

View File

@ -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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }