diff --git a/types/resolve-from/index.d.ts b/types/resolve-from/index.d.ts index da968fdaa8..9715d3ed25 100644 --- a/types/resolve-from/index.d.ts +++ b/types/resolve-from/index.d.ts @@ -1,7 +1,13 @@ -// Type definitions for resolve-from +// Type definitions for resolve-from 4.0 // Project: https://github.com/sindresorhus/resolve-from // Definitions by: unional +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function resolveFrom(fromDir: string, moduleId: string): string; -declare namespace resolveFrom {} + export = resolveFrom; + +declare function resolveFrom(fromDir: string, moduleId: string): string; + +declare namespace resolveFrom { + function silent(fromDir: string, moduleId: string): string | null; +} diff --git a/types/resolve-from/resolve-from-tests.ts b/types/resolve-from/resolve-from-tests.ts index ddbc5bdbea..dc645103ec 100644 --- a/types/resolve-from/resolve-from-tests.ts +++ b/types/resolve-from/resolve-from-tests.ts @@ -1,7 +1,6 @@ import resolveFrom = require("resolve-from"); -let from: string; -let moduleId: string; -let result: string; - -result = resolveFrom(from, moduleId); +// $ExpectType string +resolveFrom('foo', './bar'); +// $ExpectType string | null +resolveFrom.silent('foo', './baz'); diff --git a/types/resolve-from/tsconfig.json b/types/resolve-from/tsconfig.json index b1d826c64c..790d2f09ee 100644 --- a/types/resolve-from/tsconfig.json +++ b/types/resolve-from/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "resolve-from-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/resolve-from/tslint.json b/types/resolve-from/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/resolve-from/tslint.json +++ b/types/resolve-from/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/resolve-from/v2/index.d.ts b/types/resolve-from/v2/index.d.ts new file mode 100644 index 0000000000..d29d0c1676 --- /dev/null +++ b/types/resolve-from/v2/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for resolve-from 2.0 +// Project: https://github.com/sindresorhus/resolve-from +// Definitions by: unional +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare function resolveFrom(fromDir: string, moduleId: string): string; +declare namespace resolveFrom {} +export = resolveFrom; diff --git a/types/resolve-from/v2/resolve-from-tests.ts b/types/resolve-from/v2/resolve-from-tests.ts new file mode 100644 index 0000000000..ddbc5bdbea --- /dev/null +++ b/types/resolve-from/v2/resolve-from-tests.ts @@ -0,0 +1,7 @@ +import resolveFrom = require("resolve-from"); + +let from: string; +let moduleId: string; +let result: string; + +result = resolveFrom(from, moduleId); diff --git a/types/resolve-from/v2/tsconfig.json b/types/resolve-from/v2/tsconfig.json new file mode 100644 index 0000000000..d9f3015659 --- /dev/null +++ b/types/resolve-from/v2/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "resolve-from": [ + "resolve-from/v2" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "resolve-from-tests.ts" + ] +} diff --git a/types/resolve-from/v2/tslint.json b/types/resolve-from/v2/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/resolve-from/v2/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +}