From 96560e6313afcf218ed643b8272560c3f5c470b9 Mon Sep 17 00:00:00 2001 From: shawn wang Date: Sat, 2 Jun 2018 21:36:04 -0400 Subject: [PATCH] Update README.md --- README.md | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index bbab0fb3..b6a55461 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,19 @@ Please contribute on this topic! [File an issue](https://github.com/sw-yx/react- This is not yet written. Please PR or [File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new) with your suggestions! +# Working with Non-Typescript Libraries (writing your own index.d.ts) + + +Please contribute on this topic! [File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new). + +
+ +Explanation + +This is not yet written. Please PR or [File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new) with your suggestions! +
+ + # Troubleshooting Handbook: Types Facing weird type errors? You aren't alone. This is the worst part of using Typescript with React. Try to avoid typing with `any` as much as possible to experience the full benefits of typescript. Instead, let's try to be familiar with some of the common strategies to solve these issues. @@ -518,29 +531,10 @@ Adding two types together: ```tsx export interface Props { - /** this dictates what the button will say */ label: string; - /** this dictates what the button will do */ - onClick: (e: any) => void; // tslint:disable-line - /** - * Options for the button styling - * - * @default {size: default, type: primary} - * - */ - displaytype?: { - size?: ButtonSizes; - type?: ButtonTypes; - }; - /** - * Disables onclick - * - * @default false - */ - disabled?: boolean; } export const PrimaryButton = ( - props: Props & React.HTMLProps + props: Props & React.HTMLProps // adding my Props together with the @types/react button provided props ) => (