-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
81e08ad
to
a295cee
Compare
Codecov Report
@@ Coverage Diff @@
## master #1520 +/- ##
==========================================
+ Coverage 87.89% 87.90% +0.01%
==========================================
Files 378 378
Lines 6410 6417 +7
Branches 1751 1759 +8
==========================================
+ Hits 5634 5641 +7
Misses 748 748
Partials 28 28
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
à voir en fonction de eslint concernant les null | undefined et les default objects properties
import React from 'react' | ||
|
||
interface IProps { | ||
SvgElement?: React.ComponentType | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tu n'as pas besoin du null
car la prop optionnelle => ça équivaut à React.ComponentType | undefined
SvgElement?: React.ComponentType | null, | |
SvgElement?: React.ComponentType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok on à deux manière de faire :
// le type
propName?: propType
// props par defaut
propName = undefined
ou bien
// le type
propName?: propType | null
// props par defaut
propName = null
J'aime bien le null
explicite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, ça me va, mais en gros on type un truc qui peut être null / undefined / autreType
mais qui ne sera jamais undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha oui bien vu.
Du coup quelque-chose comme ca conviendrait mieux ?
interface IProps {
SvgElement?: React.ComponentType | null,
checked: boolean,
className: string,
disabled: boolean,
hiddenLabel: boolean,
isInError: boolean,
isLabelDisable: boolean,
label: string,
name: string,
onChange: () => void,
subLabel: string | null,
}
export const CheckboxInput = ({
SvgElement = null,
checked = false,
className = '',
disabled = false,
hiddenLabel = false,
isInError = false,
isLabelDisable = false,
label,
name,
onChange,
subLabel = null,
}: IProps) => {
isLabelDisable?: boolean, | ||
label: string, | ||
name: string, | ||
onChange: () => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je pense que onChange prend un param
onChange: () => void, | |
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void, |
a295cee
to
085c4fe
Compare
Afin de spliter
OfferForm
en morceaux plus lisible en utilisant Typescript, j'ai besoin que ce petit composant soit migré.