From 24f5111c1a58bfdd273c3dae2f02cf8b9a5e7beb Mon Sep 17 00:00:00 2001 From: Quentin Golsteyn Date: Sun, 9 Dec 2018 17:40:31 -0800 Subject: [PATCH 1/5] Add definition for react-panelgroup library --- types/react-panelgroup/index.d.ts | 30 ++++++++ .../react-panelgroup-tests.tsx | 68 +++++++++++++++++++ types/react-panelgroup/tsconfig.json | 16 +++++ types/react-panelgroup/tslint.json | 1 + 4 files changed, 115 insertions(+) create mode 100644 types/react-panelgroup/index.d.ts create mode 100644 types/react-panelgroup/react-panelgroup-tests.tsx create mode 100644 types/react-panelgroup/tsconfig.json create mode 100644 types/react-panelgroup/tslint.json diff --git a/types/react-panelgroup/index.d.ts b/types/react-panelgroup/index.d.ts new file mode 100644 index 0000000000..3f8ebdda54 --- /dev/null +++ b/types/react-panelgroup/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for react-panelgroup 1.0.7 +// Project: https://github.com/DanFessler/react-panelgroup +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from "react"; + +/** + * Interface used to define a number of options for a panel. + */ +export interface PanelWidth { + size?: number; + minSize?: number; + resize?: "fixed" | "dynamic" | "stretch"; + snap?: number[]; +} + +interface PropTypes { + spacing?: number; + borderColor?: string; + panelColor?: string; + direction?: "row" | "column"; + panelWidths?: Array; + onUpdate?: (data: PanelWidth) => void; +} + +/** + * React component that allows for the creation of resizable panels. + */ +export default class PanelGroup extends React.Component {} diff --git a/types/react-panelgroup/react-panelgroup-tests.tsx b/types/react-panelgroup/react-panelgroup-tests.tsx new file mode 100644 index 0000000000..fcbbeab0ee --- /dev/null +++ b/types/react-panelgroup/react-panelgroup-tests.tsx @@ -0,0 +1,68 @@ +import PanelGroup, { PanelWidth } from "react-panelgroup"; +import * as React from "react"; + +const test1 = ( + +
panel 1
+
panel 2
+
panel 3
+
+); + +const test2 = ( + +
panel 1
+
panel 2
+
panel 3
+
+); + +const test3 = ( + + +
panel 1
+
panel 2
+
panel 3
+
+
panel 4
+ +
panel 5
+
panel 6
+
+
+); + +const test4 = ( + +
panel 1
+
panel 2
+
panel 3
+
+); + +const test5 = ( + {}} + > +
panel 1
+
panel 2
+
panel 3
+
+); + +const test6: PanelWidth = { + size: 100, + minSize: 100, + resize: "fixed", + snap: [50, 75] +}; diff --git a/types/react-panelgroup/tsconfig.json b/types/react-panelgroup/tsconfig.json new file mode 100644 index 0000000000..47d08fddd7 --- /dev/null +++ b/types/react-panelgroup/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-panelgroup-tests.tsx"] +} diff --git a/types/react-panelgroup/tslint.json b/types/react-panelgroup/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-panelgroup/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9097646ef36288e9218ba3b7da6538f803323708 Mon Sep 17 00:00:00 2001 From: Quentin Golsteyn Date: Sun, 9 Dec 2018 17:44:38 -0800 Subject: [PATCH 2/5] Add Typescript version --- types/react-panelgroup/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-panelgroup/index.d.ts b/types/react-panelgroup/index.d.ts index 3f8ebdda54..3e27a266c3 100644 --- a/types/react-panelgroup/index.d.ts +++ b/types/react-panelgroup/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/DanFessler/react-panelgroup // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 import * as React from "react"; From d9ee39841e594eac9e4d7e534ab14c4fe907158f Mon Sep 17 00:00:00 2001 From: Quentin Golsteyn Date: Sun, 9 Dec 2018 17:46:46 -0800 Subject: [PATCH 3/5] Add strictFunctionTypes option --- types/react-panelgroup/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-panelgroup/tsconfig.json b/types/react-panelgroup/tsconfig.json index 47d08fddd7..ace72f23f2 100644 --- a/types/react-panelgroup/tsconfig.json +++ b/types/react-panelgroup/tsconfig.json @@ -6,6 +6,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": ["../"], "types": [], From abe292520b15fe1bb70a80e9ce8bac1a2560885c Mon Sep 17 00:00:00 2001 From: Quentin Golsteyn Date: Sun, 9 Dec 2018 17:51:49 -0800 Subject: [PATCH 4/5] Fix some testing errors --- types/react-panelgroup/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-panelgroup/index.d.ts b/types/react-panelgroup/index.d.ts index 3e27a266c3..f3c9a2b1f2 100644 --- a/types/react-panelgroup/index.d.ts +++ b/types/react-panelgroup/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-panelgroup 1.0.7 +// Type definitions for react-panelgroup 1.0 // Project: https://github.com/DanFessler/react-panelgroup // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -16,7 +16,7 @@ export interface PanelWidth { snap?: number[]; } -interface PropTypes { +export interface PropTypes { spacing?: number; borderColor?: string; panelColor?: string; From 4ff411d8c3b8bcb3e9b92d3edded31e2489716e2 Mon Sep 17 00:00:00 2001 From: Quentin Golsteyn Date: Sun, 9 Dec 2018 17:54:08 -0800 Subject: [PATCH 5/5] Add name --- types/react-panelgroup/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-panelgroup/index.d.ts b/types/react-panelgroup/index.d.ts index f3c9a2b1f2..4207d8e61d 100644 --- a/types/react-panelgroup/index.d.ts +++ b/types/react-panelgroup/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-panelgroup 1.0 // Project: https://github.com/DanFessler/react-panelgroup -// Definitions by: My Self +// Definitions by: Quentin Golsteyn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0