From 8b692ca4902b5c65f7e795eb4e5eb91fd2e04cea Mon Sep 17 00:00:00 2001 From: grgr-dkrk <40130327+grgr-dkrk@users.noreply.github.com> Date: Sat, 25 May 2019 05:55:36 +0900 Subject: [PATCH] [@types/react-aria-modal] Add type difinitions for require one parameter of 'titleId' or 'titleText' (and not both). (#35560) --- types/react-aria-modal/index.d.ts | 9 ++++++++- types/react-aria-modal/react-aria-modal-tests.tsx | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/react-aria-modal/index.d.ts b/types/react-aria-modal/index.d.ts index 4083d08473..e1c0f294d7 100644 --- a/types/react-aria-modal/index.d.ts +++ b/types/react-aria-modal/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-aria-modal 2.12 // Project: https://github.com/davidtheclark/react-aria-modal#readme // Definitions by: forabi +// dkrk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -165,6 +166,12 @@ export interface AriaModalProps { onExit(): any; } -export default class AriaModal extends React.PureComponent { +/** + * This difinition is for require one parameter of 'titleId' or 'title' (and not both) on AriaModal props. + */ +export type RequiredAriaTypes, U = Pick> = + { [K in keyof T]-? : T[K] } & { [P in keyof U]: never} | { [X in keyof T]: never } & { [Y in keyof U]-?: U[Y]}; + +export default class AriaModal extends React.PureComponent { static renderTo(node: HTMLElement | string): void; } diff --git a/types/react-aria-modal/react-aria-modal-tests.tsx b/types/react-aria-modal/react-aria-modal-tests.tsx index c8c9de62d4..d0a13428a9 100644 --- a/types/react-aria-modal/react-aria-modal-tests.tsx +++ b/types/react-aria-modal/react-aria-modal-tests.tsx @@ -7,8 +7,8 @@ declare const appContainer: HTMLElement; const onExit = () => {}; render( - - Hello world + +

Hello world

, appContainer );