From ad76e164ab712acc5ac5c5ba5cca197d02b60cfc Mon Sep 17 00:00:00 2001 From: knegusen Date: Wed, 16 May 2018 08:48:24 +0200 Subject: [PATCH 1/2] Added type definitions for react-collapsible --- types/react-collapsible/index.d.ts | 35 +++++++++++++++++++ .../react-collapsible-tests.tsx | 17 +++++++++ types/react-collapsible/tsconfig.json | 24 +++++++++++++ types/react-collapsible/tslint.json | 1 + 4 files changed, 77 insertions(+) create mode 100644 types/react-collapsible/index.d.ts create mode 100644 types/react-collapsible/react-collapsible-tests.tsx create mode 100644 types/react-collapsible/tsconfig.json create mode 100644 types/react-collapsible/tslint.json diff --git a/types/react-collapsible/index.d.ts b/types/react-collapsible/index.d.ts new file mode 100644 index 0000000000..f52e953684 --- /dev/null +++ b/types/react-collapsible/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for react-collapsible 2.2 +// Project: https://github.com/glennflanagan/react-collapsible#readme +// Definitions by: knegusen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface CollapsibleProp { + children?: string | React.ReactNode; + transitionTime?: number; + transitionCloseTime?: number; + triggerTagName?: string; + easing?: string; + open?: boolean; + classParentString?: string; + openedClassName?: string; + triggerStyle?: object; + triggerClassName?: string; + triggerOpenedClassName?: string; + contentOuterClassName?: string; + contentInnerClassName?: string; + accordionPosition?: string | number; + handleTriggerClick?: (accordionPosition?: string | number) => void; + onOpen?: () => void; + onClose?: () => void; + onOpening?: () => void; + onClosing?: () => void; + trigger?: string | React.ReactNode; + triggerWhenOpen?: string | React.ReactNode; + triggerDisabled?: boolean; + lazyRender?: boolean; + overflowWhenOpen?: 'hidden' | 'visible' | 'auto' | 'scroll' | 'inherit' | 'initial' | 'unset'; + triggerSibling?: React.ReactNode | string | (() => void); + tabIndex?: number; +} + +export default class Collapsible extends React.Component {} diff --git a/types/react-collapsible/react-collapsible-tests.tsx b/types/react-collapsible/react-collapsible-tests.tsx new file mode 100644 index 0000000000..69050d6b8c --- /dev/null +++ b/types/react-collapsible/react-collapsible-tests.tsx @@ -0,0 +1,17 @@ +import Collapsible from "react-collapsible"; +import * as React from "react"; + +const Component = ( +
+ +

+ This is the collapsible content. It can be any element or React + component you like. +

+

+ It can even be another Collapsible component. Check out the next + section! +

+
+
+); diff --git a/types/react-collapsible/tsconfig.json b/types/react-collapsible/tsconfig.json new file mode 100644 index 0000000000..a75a29a44a --- /dev/null +++ b/types/react-collapsible/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-collapsible-tests.tsx" + ] +} diff --git a/types/react-collapsible/tslint.json b/types/react-collapsible/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-collapsible/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a4bb93652611df2859712cefc36b92ff75aa9226 Mon Sep 17 00:00:00 2001 From: knegusen Date: Wed, 16 May 2018 08:55:50 +0200 Subject: [PATCH 2/2] Specify version of typescript in declaration file --- types/react-collapsible/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-collapsible/index.d.ts b/types/react-collapsible/index.d.ts index f52e953684..ad56aba34e 100644 --- a/types/react-collapsible/index.d.ts +++ b/types/react-collapsible/index.d.ts @@ -2,7 +2,9 @@ // Project: https://github.com/glennflanagan/react-collapsible#readme // Definitions by: knegusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 +import * as React from "react"; export interface CollapsibleProp { children?: string | React.ReactNode; transitionTime?: number;