From af68d2616c56b06c3a438fef6ddb3610c6439816 Mon Sep 17 00:00:00 2001 From: Ajil Oommen Date: Thu, 4 Apr 2019 09:48:07 +0530 Subject: [PATCH 1/4] Added TypeDefinitions for project-name --- types/project-name/index.d.ts | 10 +++ types/project-name/project-name-tests.ts | 3 + types/project-name/tsconfig.json | 23 +++++++ types/project-name/tslint.json | 80 ++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 types/project-name/index.d.ts create mode 100644 types/project-name/project-name-tests.ts create mode 100644 types/project-name/tsconfig.json create mode 100644 types/project-name/tslint.json diff --git a/types/project-name/index.d.ts b/types/project-name/index.d.ts new file mode 100644 index 00000000000000..2bd513e4b4e66a --- /dev/null +++ b/types/project-name/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for project-name +// Project: https://github.com/jonschlinkert/project-name +// Definitions by: Ajil Oommen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Type Definition for project-name + * @param cwd The Base Current Working Directory of project + */ +export default function (cwd: string): string; \ No newline at end of file diff --git a/types/project-name/project-name-tests.ts b/types/project-name/project-name-tests.ts new file mode 100644 index 00000000000000..0b7e4b20e73b3e --- /dev/null +++ b/types/project-name/project-name-tests.ts @@ -0,0 +1,3 @@ +import name from 'project-name'; + +name('d'); // $ExpectType string \ No newline at end of file diff --git a/types/project-name/tsconfig.json b/types/project-name/tsconfig.json new file mode 100644 index 00000000000000..bf0087c08f6744 --- /dev/null +++ b/types/project-name/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "project-name-tests.ts" + ] +} \ No newline at end of file diff --git a/types/project-name/tslint.json b/types/project-name/tslint.json new file mode 100644 index 00000000000000..3d59f55fdabcf4 --- /dev/null +++ b/types/project-name/tslint.json @@ -0,0 +1,80 @@ +{ + "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, + "npm-naming": 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 + } +} From 479ec34950240d54c4c315301d4b8b88aa320d21 Mon Sep 17 00:00:00 2001 From: Ajil Oommen Date: Thu, 4 Apr 2019 10:37:22 +0530 Subject: [PATCH 2/4] Fixed TSConfig --- types/project-name/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/project-name/tsconfig.json b/types/project-name/tsconfig.json index bf0087c08f6744..63a5187ec818e8 100644 --- a/types/project-name/tsconfig.json +++ b/types/project-name/tsconfig.json @@ -5,8 +5,8 @@ "es6" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From 552880ccfaa4611717bbbb87b34002dbb88da022 Mon Sep 17 00:00:00 2001 From: Ajil Oommen Date: Mon, 8 Apr 2019 09:32:46 +0530 Subject: [PATCH 3/4] Modified export sytax --- types/project-name/index.d.ts | 5 +++-- types/project-name/project-name-tests.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/project-name/index.d.ts b/types/project-name/index.d.ts index 2bd513e4b4e66a..264c70152e5c17 100644 --- a/types/project-name/index.d.ts +++ b/types/project-name/index.d.ts @@ -3,8 +3,9 @@ // Definitions by: Ajil Oommen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export = index; /** * Type Definition for project-name - * @param cwd The Base Current Working Directory of project + * @param cwd The Base Current Working Directory of project */ -export default function (cwd: string): string; \ No newline at end of file +declare function index(cwd: string): string; \ No newline at end of file diff --git a/types/project-name/project-name-tests.ts b/types/project-name/project-name-tests.ts index 0b7e4b20e73b3e..c48ab97e8d2fcb 100644 --- a/types/project-name/project-name-tests.ts +++ b/types/project-name/project-name-tests.ts @@ -1,3 +1,3 @@ -import name from 'project-name'; +import name = require('project-name'); name('d'); // $ExpectType string \ No newline at end of file From c955b7631e912f8525231e008c469ccb1244dd26 Mon Sep 17 00:00:00 2001 From: Ajil Oommen Date: Tue, 9 Apr 2019 09:55:00 +0530 Subject: [PATCH 4/4] Additional Fixes --- types/project-name/index.d.ts | 6 +- types/project-name/project-name-tests.ts | 3 +- types/project-name/tslint.json | 81 +----------------------- 3 files changed, 6 insertions(+), 84 deletions(-) diff --git a/types/project-name/index.d.ts b/types/project-name/index.d.ts index 264c70152e5c17..c904a4c274de39 100644 --- a/types/project-name/index.d.ts +++ b/types/project-name/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for project-name +// Type definitions for project-name 1.0 // Project: https://github.com/jonschlinkert/project-name -// Definitions by: Ajil Oommen +// Definitions by: Ajil Oommen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = index; @@ -8,4 +8,4 @@ export = index; * Type Definition for project-name * @param cwd The Base Current Working Directory of project */ -declare function index(cwd: string): string; \ No newline at end of file +declare function index(cwd?: string): string; diff --git a/types/project-name/project-name-tests.ts b/types/project-name/project-name-tests.ts index c48ab97e8d2fcb..ded0b5a703e231 100644 --- a/types/project-name/project-name-tests.ts +++ b/types/project-name/project-name-tests.ts @@ -1,3 +1,4 @@ import name = require('project-name'); -name('d'); // $ExpectType string \ No newline at end of file +name('d'); // $ExpectType string +name(); // $ExpectType string diff --git a/types/project-name/tslint.json b/types/project-name/tslint.json index 3d59f55fdabcf4..3db14f85eaf7b9 100644 --- a/types/project-name/tslint.json +++ b/types/project-name/tslint.json @@ -1,80 +1 @@ -{ - "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, - "npm-naming": 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" }