Add types for resolve-from v4

This commit is contained in:
Dimitri Benin
2018-12-12 20:13:22 +01:00
parent 4fc1ea2388
commit 855c9defd9
4 changed files with 45 additions and 0 deletions

13
types/resolve-from/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// Type definitions for resolve-from 4.0
// Project: https://github.com/sindresorhus/resolve-from
// Definitions by: unional <https://github.com/unional>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = resolveFrom;
declare function resolveFrom(fromDir: string, moduleId: string): string;
declare namespace resolveFrom {
function silent(fromDir: string, moduleId: string): string | null;
}

View File

@@ -0,0 +1,6 @@
import resolveFrom = require("resolve-from");
// $ExpectType string
resolveFrom('foo', './bar');
// $ExpectType string | null
resolveFrom.silent('foo', './baz');

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"resolve-from-tests.ts"
]
}

View File

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