react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Migrate core widget folder to typescript

Open jimmycallin opened this issue 3 years ago • 2 comments
trafficstars

Reasons for making this change

Migrated widgets folder to Typescript.

Since I'm quite new in Typescript land, please look thoroughly at my changes and don't hesitate writing picky comments as I would like to learn how to do this properly. :)

Checklist

  • [ ] I'm updating documentation
  • [x] I'm adding or updating code
    • [ ] I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • [ ] I've updated docs if needed
    • [ ] I've updated the changelog with a description of the PR
  • [ ] I'm adding a new feature
    • [ ] I've updated the playground with an example use of the feature

jimmycallin avatar Aug 07 '22 22:08 jimmycallin

@jimmycallin FYI, I'm doing the conversion of Fields today so no need to do them if you were considering it

heath-freenome avatar Aug 08 '22 20:08 heath-freenome

@heath-freenome I think/hope I addressed all your comments now!

jimmycallin avatar Aug 09 '22 22:08 jimmycallin

So changing any to WidgetProps<T, F> broke things?

(Weirdly enough I couldn't respond directly to that comment)

Yes, exactly. Getting the following error:

semantic error TS2769: No overload matches this call.
  Overload 1 of 2, '(props: WidgetProps<T, F>, context?: any): ReactElement<any, any> | Component<WidgetProps<T, F>, any, any> | null', gave the following error.
    Type '{ schema: { type: "integer"; }; id: string; className: string; options: { enumOptions: { value: number; label: string; }[]; }; placeholder: any; value: any; disabled: boolean | undefined; readonly: boolean | undefined; autofocus: boolean | undefined; onChange: (value: any) => any; onBlur: (id: string, value: any) =>...' is missing the following properties from type 'WidgetProps<T, F>': onFocus, label, registry

jimmycallin avatar Aug 11 '22 18:08 jimmycallin

Ready for review again!

jimmycallin avatar Aug 11 '22 18:08 jimmycallin

So changing any to WidgetProps<T, F> broke things?

(Weirdly enough I couldn't respond directly to that comment)

Yes, exactly. Getting the following error:

semantic error TS2769: No overload matches this call.
  Overload 1 of 2, '(props: WidgetProps<T, F>, context?: any): ReactElement<any, any> | Component<WidgetProps<T, F>, any, any> | null', gave the following error.
    Type '{ schema: { type: "integer"; }; id: string; className: string; options: { enumOptions: { value: number; label: string; }[]; }; placeholder: any; value: any; disabled: boolean | undefined; readonly: boolean | undefined; autofocus: boolean | undefined; onChange: (value: any) => any; onBlur: (id: string, value: any) =>...' is missing the following properties from type 'WidgetProps<T, F>': onFocus, label, registry

I'll look at it once it merges and see if I can figure out what the problem is

heath-freenome avatar Aug 12 '22 00:08 heath-freenome