From 6115bd3acf942509fdb99fca27a2a795ff01247e Mon Sep 17 00:00:00 2001 From: Keisuke Kan <9renpoto@gmail.com> Date: Thu, 9 Nov 2017 21:38:16 +0900 Subject: [PATCH 1/3] Added react-calendar-heatmap --- types/react-calendar-heatmap/index.d.ts | 32 ++++++++ .../react-calendar-heatmap-tests.tsx | 16 ++++ types/react-calendar-heatmap/tsconfig.json | 25 ++++++ types/react-calendar-heatmap/tslint.json | 79 +++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 types/react-calendar-heatmap/index.d.ts create mode 100644 types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx create mode 100644 types/react-calendar-heatmap/tsconfig.json create mode 100644 types/react-calendar-heatmap/tslint.json diff --git a/types/react-calendar-heatmap/index.d.ts b/types/react-calendar-heatmap/index.d.ts new file mode 100644 index 0000000000..9a977deeb1 --- /dev/null +++ b/types/react-calendar-heatmap/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-calendar-heatmap v1.6.1 +// Project: https://github.com/patientslikeme/react-calendar-heatmap +// Definitions by: Keisuke Kan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare module "react-calendar-heatmap" { + interface Props { + classForValue?: Function + endDate?: string | number | Date + gutterSize?: number + horizontal?: boolean + monthLabels?: string[] + numDays?: number + onClick?: Function + onMouseLeave?: Function, + onMouseOver?: Function, + showMonthLabels?: boolean + showOutOfRangeDays?: boolean + showWeekdayLabels?: boolean, + startDate?: string | number | Date, + titleForValue?: Function, + tooltipDataAttrs?: Object | Function + transformDayElement?: Function, + values: any[] + weekdayLabels?: string[] + } + let ReactCalendarHeatmap : React.ClassicComponentClass; + export default ReactCalendarHeatmap; +} \ No newline at end of file diff --git a/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx b/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx new file mode 100644 index 0000000000..6d66508ca0 --- /dev/null +++ b/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx @@ -0,0 +1,16 @@ +import * as React from "react" +import CalendarHeatmap from "react-calendar-heatmap" + +export default function() { + return ( + + ) +} \ No newline at end of file diff --git a/types/react-calendar-heatmap/tsconfig.json b/types/react-calendar-heatmap/tsconfig.json new file mode 100644 index 0000000000..ad3ac4522c --- /dev/null +++ b/types/react-calendar-heatmap/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-calendar-heatmap-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-calendar-heatmap/tslint.json b/types/react-calendar-heatmap/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/react-calendar-heatmap/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 + } +} From 2f83d96a3feeb81da975dca867744b87675d666d Mon Sep 17 00:00:00 2001 From: Keisuke Kan <9renpoto@gmail.com> Date: Fri, 10 Nov 2017 10:08:41 +0900 Subject: [PATCH 2/3] refactor(types/react-calendar-heatmap) Update Function types --- types/react-calendar-heatmap/index.d.ts | 50 ++++++------ .../react-calendar-heatmap-tests.tsx | 28 +++---- types/react-calendar-heatmap/tsconfig.json | 2 +- types/react-calendar-heatmap/tslint.json | 78 +------------------ 4 files changed, 40 insertions(+), 118 deletions(-) diff --git a/types/react-calendar-heatmap/index.d.ts b/types/react-calendar-heatmap/index.d.ts index 9a977deeb1..b4efd2b156 100644 --- a/types/react-calendar-heatmap/index.d.ts +++ b/types/react-calendar-heatmap/index.d.ts @@ -1,32 +1,30 @@ -// Type definitions for react-calendar-heatmap v1.6.1 +// Type definitions for react-calendar-heatmap 1.6 // Project: https://github.com/patientslikeme/react-calendar-heatmap // Definitions by: Keisuke Kan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +import * as React from 'react'; -declare module "react-calendar-heatmap" { - interface Props { - classForValue?: Function - endDate?: string | number | Date - gutterSize?: number - horizontal?: boolean - monthLabels?: string[] - numDays?: number - onClick?: Function - onMouseLeave?: Function, - onMouseOver?: Function, - showMonthLabels?: boolean - showOutOfRangeDays?: boolean - showWeekdayLabels?: boolean, - startDate?: string | number | Date, - titleForValue?: Function, - tooltipDataAttrs?: Object | Function - transformDayElement?: Function, - values: any[] - weekdayLabels?: string[] - } - let ReactCalendarHeatmap : React.ClassicComponentClass; - export default ReactCalendarHeatmap; -} \ No newline at end of file +export interface Props { + classForValue?: (value: any) => 'color-filled' | 'color-empty'; + endDate?: string | number | Date; + gutterSize?: number; + horizontal?: boolean; + monthLabels?: string[]; + numDays?: number; + onClick?: (value: any) => void; + onMouseLeave?: (e: any, value: any) => void; + onMouseOver?: (e: any, value: any) => void; + showMonthLabels?: boolean; + showOutOfRangeDays?: boolean; + showWeekdayLabels?: boolean; + startDate?: string | number | Date; + titleForValue?: (value: any) => any; + tooltipDataAttrs?: object; + transformDayElement?: (rect: any, value: any, index: number) => any; + values: any[]; + weekdayLabels?: string[]; +} + +export default class ReactCalendarHeatmap extends React.Component {} diff --git a/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx b/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx index 6d66508ca0..4e807ddfcd 100644 --- a/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx +++ b/types/react-calendar-heatmap/react-calendar-heatmap-tests.tsx @@ -1,16 +1,16 @@ -import * as React from "react" -import CalendarHeatmap from "react-calendar-heatmap" +import * as React from 'react'; +import CalendarHeatmap from 'react-calendar-heatmap'; export default function() { - return ( - - ) -} \ No newline at end of file + return ( + + ); +} diff --git a/types/react-calendar-heatmap/tsconfig.json b/types/react-calendar-heatmap/tsconfig.json index ad3ac4522c..f605aa4478 100644 --- a/types/react-calendar-heatmap/tsconfig.json +++ b/types/react-calendar-heatmap/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/react-calendar-heatmap/tslint.json b/types/react-calendar-heatmap/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/react-calendar-heatmap/tslint.json +++ b/types/react-calendar-heatmap/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" } From 81299f8f4a83e01303ab60627d0ac4802b72bf51 Mon Sep 17 00:00:00 2001 From: Keisuke Kan <9renpoto@gmail.com> Date: Fri, 10 Nov 2017 10:13:15 +0900 Subject: [PATCH 3/3] fix(types/react-calendar-heatmap) classForValue props response type --- types/react-calendar-heatmap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-calendar-heatmap/index.d.ts b/types/react-calendar-heatmap/index.d.ts index b4efd2b156..f15ff887ca 100644 --- a/types/react-calendar-heatmap/index.d.ts +++ b/types/react-calendar-heatmap/index.d.ts @@ -7,7 +7,7 @@ import * as React from 'react'; export interface Props { - classForValue?: (value: any) => 'color-filled' | 'color-empty'; + classForValue?: (value: any) => any; endDate?: string | number | Date; gutterSize?: number; horizontal?: boolean;