When working with large callback functions, I prefer defining them in the script tag rather than inlining them in the markup. However, I couldn't find a built-in helper type for typing a form ...
TypeScript currently has two intentional behaviors related to type narrowing: Narrowings are not respected inside callbacks because the variable’s value could change by the time the callback runs.