Unable to type input handlers

Hello,

I’m trying to use a handler for an input field but can’t figure out how to type it:

const onInput = (e: React.ChangeEvent<HTMLInputElement>) => {
}

<s-search-field onInput={ onInput } />

App bridge types is complaining:

image

It tried all kind of combination but could not find how to properly type those callbacks.

Thanks.

Hey again @bakura10 :waving_hand:

Can you try the below: const onInput: (e: CallbackEvent<'s-search-field', Event>) => void = (e) => { setQuery(e.currentTarget.value); }

If that doesn’t work, just let me know and I’m happy to dig further into this.

2 Likes

Thanks a lot @Alan_G ! It seems to work. I did not realize the CallbackEvent was actually exported :).

1 Like

No worries @bakura10 - glad I could help with this one!