From e875fc829ac9daa6ce81bf04dbdbb1607ee8fe53 Mon Sep 17 00:00:00 2001 From: Artur Eshenbrener Date: Fri, 10 Feb 2017 11:02:43 +0300 Subject: [PATCH] react: make defaultProps Partial

Added a test, which ensures that defaultProps are Partial --- react/test/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/react/test/index.ts b/react/test/index.ts index 38ad574aa4..64d5d9d918 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -689,3 +689,18 @@ type InputChangeEvent = React.ChangeEvent; type InputFormEvent = React.FormEvent; const changeEvent:InputChangeEvent = undefined as any; const formEvent:InputFormEvent = changeEvent; + +// defaultProps should be optional of props +{ + interface ComponentProps { + prop1: string; + prop2: string; + prop3?: string; + } + class ComponentWithDefaultProps extends React.Component { + static defaultProps = { + prop3: "default value", + }; + } + const VariableWithAClass: React.ComponentClass = ComponentWithDefaultProps; +}