From e39fd75419e0161bb8aa93245d7db90a45af2271 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Wed, 2 Oct 2019 22:30:07 +0200 Subject: [PATCH] Add types for react-add-to-calendar package (#38751) --- types/react-add-to-calendar/index.d.ts | 35 +++++++++++++++++++ .../react-add-to-calendar-tests.tsx | 34 ++++++++++++++++++ types/react-add-to-calendar/tsconfig.json | 26 ++++++++++++++ types/react-add-to-calendar/tslint.json | 1 + 4 files changed, 96 insertions(+) create mode 100644 types/react-add-to-calendar/index.d.ts create mode 100644 types/react-add-to-calendar/react-add-to-calendar-tests.tsx create mode 100644 types/react-add-to-calendar/tsconfig.json create mode 100644 types/react-add-to-calendar/tslint.json diff --git a/types/react-add-to-calendar/index.d.ts b/types/react-add-to-calendar/index.d.ts new file mode 100644 index 0000000000..be22b1638a --- /dev/null +++ b/types/react-add-to-calendar/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for react-add-to-calendar 0.1 +// Project: https://github.com/jasonsalzman/react-add-to-calendar +// Definitions by: Konstantin Lebedev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +export interface AddToCalendarEvent { + title?: string; + description?: string; + location?: string; + startTime?: string | Date; + endTime?: string | Date; +} + +export interface AddToCalendarProps { + buttonClassClosed?: string; + buttonClassOpen?: string; + buttonLabel?: string; + buttonTemplate?: any; + buttonIconClass?: string; + useFontAwesomeIcons?: boolean; + buttonWrapperClass?: string; + displayItemIcons?: boolean; + optionsOpen?: boolean; + dropdownClass?: string; + event: AddToCalendarEvent; + listItems?: any[]; + rootClass?: string; +} + +declare const ReactAddToCalendar: React.ComponentClass; + +export default ReactAddToCalendar; diff --git a/types/react-add-to-calendar/react-add-to-calendar-tests.tsx b/types/react-add-to-calendar/react-add-to-calendar-tests.tsx new file mode 100644 index 0000000000..36fea0f86f --- /dev/null +++ b/types/react-add-to-calendar/react-add-to-calendar-tests.tsx @@ -0,0 +1,34 @@ +import AddToCalendar from "react-add-to-calendar"; +import * as React from "react"; + +const sampleEvent = { + title: 'Sample Event', + description: 'This is the sample event provided as an example only', + location: 'Portland, OR', + startTime: '2016-09-16T20:15:00-04:00', + endTime: '2016-09-16T21:45:00-04:00' +}; + +const AddToCalendarRequiredOptions: JSX.Element = ( + +); + +const AddToCalendarAllOptions: JSX.Element = ( + +); diff --git a/types/react-add-to-calendar/tsconfig.json b/types/react-add-to-calendar/tsconfig.json new file mode 100644 index 0000000000..91eb28e5a5 --- /dev/null +++ b/types/react-add-to-calendar/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "react-add-to-calendar-tests.tsx" + ] +} diff --git a/types/react-add-to-calendar/tslint.json b/types/react-add-to-calendar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-add-to-calendar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }