Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/webapp/src/components/AddSensors/Partners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ const Partners = ({ hasActiveConnection }: PartnersProps) => {
<div>{t('SENSOR.ESCI.CONNECT_NEW_SENSOR')}</div>
<div className={styles.idInputWrapper}>
<InputBaseLabel label={t('SENSOR.ESCI.ENTER_ID')} />
{/* @ts-ignore */}
<Input
placeholder={t('SENSOR.ESCI.ORGANISATION_ID')}
type="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export default function AddAnimalsFormCard({
}}
/>
{!shouldCreateIndividualProfiles && (
// @ts-expect-error
<Input
label={t('ADD_ANIMAL.BATCH_NAME')}
optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ const GeneralDetails = ({
)}
{animalOrBatch === AnimalOrBatchKeys.BATCH && (
<>
{/* @ts-expect-error */}
<Input
type="text"
label={t('ANIMAL.ATTRIBUTE.BATCH_NAME')}
Expand Down Expand Up @@ -225,7 +224,6 @@ const GeneralDetails = ({
/>
{isOtherUseSelected && (
<>
{/* @ts-expect-error */}
<Input
type="text"
label={t('ANIMAL.ATTRIBUTE.OTHER_USE')}
Expand Down
14 changes: 4 additions & 10 deletions packages/webapp/src/components/Animals/DetailCards/Origin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
const fields = useMemo(() => {
return origin === AnimalOrigins.BROUGHT_IN ? (
<>
{/* @ts-expect-error */}
<Input
key={DetailsFields.BROUGHT_IN_DATE}
type="date"
Expand All @@ -72,14 +71,13 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
setIsBroughtInDateValid(true);
clearErrors(`${namePrefix}${DetailsFields.BROUGHT_IN_DATE}`);
}}
onKeyUp={(e: any) => {
setIsBroughtInDateValid(!e.target.validity.badInput);
onKeyUp={(e: React.KeyboardEvent<HTMLInputElement>): void => {
setIsBroughtInDateValid(!e.currentTarget.validity.badInput);
}}
errors={getInputErrors(errors, `${namePrefix}${DetailsFields.BROUGHT_IN_DATE}`)}
optional
disabled={mode === 'readonly'}
/>
{/* @ts-expect-error */}
<Input
key={DetailsFields.SUPPLIER}
type="text"
Expand All @@ -94,7 +92,6 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
errors={getInputErrors(errors, `${namePrefix}${DetailsFields.SUPPLIER}`)}
disabled={mode === 'readonly'}
/>
{/* @ts-expect-error */}
<Input
key={DetailsFields.PRICE}
type="number"
Expand All @@ -112,7 +109,6 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
</>
) : (
<>
{/* @ts-expect-error */}
<Input
key={DetailsFields.DAM}
type="text"
Expand All @@ -127,7 +123,6 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
errors={getInputErrors(errors, `${namePrefix}${DetailsFields.DAM}`)}
disabled={mode === 'readonly'}
/>
{/* @ts-expect-error */}
<Input
key={DetailsFields.SIRE}
type="text"
Expand All @@ -147,7 +142,6 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
}, [origin, Object.entries(errors)]);
return (
<div className={styles.sectionWrapper}>
{/* @ts-expect-error */}
<Input
type="date"
label={t('ANIMAL.ATTRIBUTE.DATE_OF_BIRTH')}
Expand All @@ -163,8 +157,8 @@ const Origin = ({ t, currency, originOptions, namePrefix = '', mode = 'add' }: O
setIsBirthDateValid(true);
clearErrors(`${namePrefix}${DetailsFields.DATE_OF_BIRTH}`);
}}
onKeyUp={(e: React.ChangeEvent<HTMLInputElement>): void => {
setIsBirthDateValid(!e.target.validity.badInput);
onKeyUp={(e: React.KeyboardEvent<HTMLInputElement>): void => {
Copy link
Collaborator Author

@kathyavini kathyavini Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like KeyboardEvent is the correct type for onKeyUp within the @types/react index.d.ts (found via click-following e.g. KeyboardEvent and searching file):

// Keyboard Events
onKeyDown?: KeyboardEventHandler<T> | undefined;
onKeyUp?: KeyboardEventHandler<T> | undefined;

Also in that file there are some comments about target vs currentTarget which are interesting and a link to this GitHub issue. This was all new to me, but it looks like .currentTarget, which is the only one that doesn't trigger type error here, is also the one we want.

(I did also verify in in component that functionality is unchanged 😂)

setIsBirthDateValid(!e.currentTarget.validity.badInput);
}}
errors={getInputErrors(errors, `${namePrefix}${DetailsFields.DATE_OF_BIRTH}`)}
optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const OtherDetails = ({
<div className={styles.sectionWrapper}>
{animalOrBatch === AnimalOrBatchKeys.ANIMAL && (
<>
{/* @ts-expect-error */}
<Input
type="date"
label={t('ANIMAL.ATTRIBUTE.WEANING_DATE')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const UniqueDetails = ({

return (
<div className={styles.sectionWrapper}>
{/* @ts-expect-error */}
<Input
type="text"
label={t('common:NAME')}
Expand All @@ -61,7 +60,6 @@ const UniqueDetails = ({
errors={getInputErrors(errors, `${namePrefix}${DetailsFields.NAME}`)}
disabled={mode === 'readonly'}
/>
{/* @ts-expect-error */}
<Input
type="text"
label={t('ANIMAL.ATTRIBUTE.TAG_NUMBER')}
Expand Down Expand Up @@ -106,7 +104,6 @@ const UniqueDetails = ({
/>
{shouldShowTagTypeInput && (
<>
{/* @ts-expect-error */}
<Input
type="text"
hookFormRegister={register(`${namePrefix}${DetailsFields.TAG_TYPE_INFO}`, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export default function RemoveAnimalsModal(props: RemoveAnimalsModalProps) {
)}

{!isCreatedInError(selectedOption) && (
/* @ts-expect-error */
<Input
type={'date'}
label={t('common:DATE')}
Expand All @@ -208,7 +207,6 @@ export default function RemoveAnimalsModal(props: RemoveAnimalsModalProps) {
</div>
) : (
<>
{/*@ts-expect-error*/}
<Input
hookFormRegister={register(EXPLANATION)}
label={t('REMOVE_ANIMALS.EXPLANATION')}
Expand Down
Loading