rescriptbr / reform

📋 Reasonably making forms sound good
https://rescript-reform.netlify.app/
MIT License
354 stars 41 forks source link

Warning `'with' clause is useless` whenever state lenses have only one field #195

Closed nireno closed 3 years ago

nireno commented 3 years ago

Is there any way to avoid the following warning when using the [%lenses ...] ppx when the state has only one field?

File "_none_", line 1:
Warning 23: all the fields are explicitly listed in this record:
the 'with' clause is useless.

Sample code that generates the above error:

module StateLenses = [%lenses
  type state = {
    email: string,
  }
];

I've been adding a dummy field in there just to silence the warning.

fakenickels commented 3 years ago

I added a check in the past to prevent that in lenses-ppx

https://github.com/Astrocoders/lenses-ppx/blob/master/packages/ppx/src/LensesPpx.re#L20-L22

Which version of lenses-ppx are you using?

nireno commented 3 years ago

@fakenickels I was working off of the demo project in this repo which was on version 5. I created a pull request that updates the package.

Thank you.

fakenickels commented 3 years ago

That's fantastic, thank you @nireno