I have an app using React and TypeScript. I recently updated my type definitions to use the npm @types namespace to store them in my node_modules folder.
Previously when working with DOM Events a method signature like this satisfied the type definitions:
public updateValue(e: React.FormEvent): void {
Now However I get compiler errors:
(46,25): error TS2314: Generic type 'FormEvent<T>' requires 1 type argument(s).
And after looking in the react type definitions folder it does indeed take in a generic:
interface FormEvent<T> extends SyntheticEvent<T> {
}
My question is basically what is the use case for this generic, how should it be used and what advantages does it add? I could simply change my method to:
public updateValue(e: React.FormEvent<any>): void {
And this would satisfy the type definition requirement. But what is the intended use case?
types 2.0- github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/react/… Not sure if I can aim it at a different repo?