Skip to content

Instantly share code, notes, and snippets.

@joelbarbosa
Last active April 22, 2021 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelbarbosa/aff6273b56add20ebd7063af243cbc9b to your computer and use it in GitHub Desktop.
Save joelbarbosa/aff6273b56add20ebd7063af243cbc9b to your computer and use it in GitHub Desktop.
type EventTarget with typescript
type EventTarget<T> = EventTarget & T;
interface FormEvent<T> extends Event {
target: EventTarget<T>;
}
function handleSubmit(event: FormEvent<{price: number}>) {
event.target.price;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment