wsmd/react-use-form-state

Improve types for BaseInputProps

danielbuechele opened this issue · 1 comments

The type definition for BaseInputProps types the name as string. However, we could type this more strictly: https://github.com/wsmd/react-use-form-state/blob/master/src/index.d.ts#L135

-interface BaseInputProps {
+interface BaseInputProps<T> {
  id: string;
  onChange(event: any): void;
  onBlur(event: any): void;
  value: string;
-  name: string;
+  name: keyof T;
  type: string;
}

I would create a PR, but the version published to NPM differs from the one here on GitHub, so I am not sure if all changes are yet pushed to GitHub

wsmd commented

Good point! I like that 👍

RE: npm/GitHub - The code on the master branch always include the latest upcoming changes - it does not necessarily reflect what's on npm as latest. In other words, the link you attached is pointing to most up-to-date code that will be published in the next release.

0.9.1 was an exception since I didn't see any reason to hold off until the next release after giving it some thought. (744d54a of master is tagged with 0.9.1)

https://github.com/wsmd/react-use-form-state/tree/0.9.1

Please feel free to open a PR against master - If you were to make those changes, they will be published in the next release.

I should probably consider a better git/branching flow as more contributors are helping with the project. I'm thinking maybe a next development branch, with master being the npm latest.