fixing types
This commit is contained in:
@@ -330,7 +330,7 @@ const copyBarcodeImage = (canvas:HTMLCanvasElement, decoderResult:Result):string
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Finds PDF417 code within a file and decodes it */
|
/** Finds PDF417 code within a file and decodes it */
|
||||||
const decodeFromFile = async (file:File) => {
|
const decodeFromFile = async (file:File): Promise<DecodeResult[]|null> => {
|
||||||
switch(file.type) {
|
switch(file.type) {
|
||||||
case 'image/png':
|
case 'image/png':
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
@@ -347,7 +347,7 @@ const decodeFromFile = async (file:File) => {
|
|||||||
// remove null results (pages with no PDF417 codes)
|
// remove null results (pages with no PDF417 codes)
|
||||||
.filter((result) => result !== null)
|
.filter((result) => result !== null)
|
||||||
// flatten the array of arrays into a single array
|
// flatten the array of arrays into a single array
|
||||||
.flat();
|
.flat() as DecodeResult[];
|
||||||
|
|
||||||
return(results);
|
return(results);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export const BillEditForm:FC<BillEditFormProps> = ({ location, bill }) => {
|
|||||||
setBarcodeResults(null);
|
setBarcodeResults(null);
|
||||||
|
|
||||||
const results = await findDecodePdf417(event);
|
const results = await findDecodePdf417(event);
|
||||||
|
|
||||||
if(results && results.length > 0) {
|
if(results && results.length > 0) {
|
||||||
|
|
||||||
if(results.length === 1) {
|
if(results.length === 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user