kciter / react-barcode

A <Barcode/> component for use with React.
http://kciter.github.io/react-barcode/
ISC License
396 stars 72 forks source link

fix(type): change property ean128 to be optional #98

Closed ItanuRomero closed 3 months ago

ItanuRomero commented 3 months ago

Explained on: https://github.com/kciter/react-barcode/commit/0f82a5647e820cb8f0bbcb200249dffbfcdd62bd#commitcomment-142113801

Basically: Adding ean128 as an mandatory prop is a breaking change, how about we add an optional prop, using the "?" symbol?

This change will clear errors such as:

Type error: No overload matches this call.
  Overload 1 of 2, '(props: BarcodeProps | Readonly<BarcodeProps>): Barcode', gave the following error.
    Property 'ean128' is missing in type '{ value: string; format: "ITF"; displayValue: false; }' but required in type 'Readonly<BarcodeProps>'.
  Overload 2 of 2, '(props: BarcodeProps, context: any): Barcode', gave the following error.
    Property 'ean128' is missing in type '{ value: string; format: "ITF"; displayValue: false; }' but required in type 'Readonly<BarcodeProps>'

And since this call already has an default value, not sending the property will have the same result as before.

kciter commented 3 months ago

Thank you. 1.5.3 released now.

ItanuRomero commented 3 months ago

Thanks, keep up the great work!