Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#32854 from sargant/fix-redux-form-…
Browse files Browse the repository at this point in the history
…field-definition

[redux-form] - Fix for failing Field definition in TypeScript 3.2+
  • Loading branch information
minestarks authored Feb 14, 2019
2 parents fe74af5 + 32a4039 commit b429791
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/redux-form/lib/Field.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type GenericFieldHTMLAttributes =
SelectHTMLAttributes<HTMLSelectElement> |
TextareaHTMLAttributes<HTMLTextAreaElement>;

export class Field<P = GenericFieldHTMLAttributes | BaseFieldProps> extends Component<BaseFieldProps<P> & P> {
export class Field<P extends GenericFieldHTMLAttributes | BaseFieldProps = GenericFieldHTMLAttributes | BaseFieldProps> extends Component<P> {
dirty: boolean;
name: string;
pristine: boolean;
Expand Down
6 changes: 6 additions & 0 deletions types/redux-form/redux-form-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ const Test = reduxForm<TestFormData>({
component="select"
/>

<Field
name="field4"
component={ MyField }
foo="bar"
/>

<FieldCustom
name="field4"
component={ MyField }
Expand Down

0 comments on commit b429791

Please sign in to comment.