foxhound87 / mobx-react-form

Reactive MobX Form State Management
https://foxhound87.github.io/mobx-react-form
MIT License
1.09k stars 129 forks source link

Clear way for typing rewriter binding #600

Open Gruzchick opened 2 years ago

Gruzchick commented 2 years ago

Is there any type (let's call it FieldPropNames) to be used in this way

import type { TextFieldProps } from "@mui/material/TextField/TextField";

export const muiTextFieldBinding: Record<FieldPropNames, keyof TextFieldProps> = {
  // ...
};

or may be way to infer this type?

foxhound87 commented 5 months ago

Maybe you need FieldPropsEnum from the models, with something like key in FieldPropsEnum

import { FieldPropsEnum } from 'mobx-react-form/lib/models/FieldProps'