mutative icon indicating copy to clipboard operation
mutative copied to clipboard

Ability to make Strict Mode the default

Open rynti opened this issue 1 year ago • 1 comments

Hey there, I hope this is an okay place to ask this question.

I was wondering if there was any way to by default enable strict mode globally? I'd like to enable strict mode by default in a development build, and turn it off for production, but haven't found an ergonomic way to do that.

In your docs this is also the recommended way: image

Would love to hear suggestions for users of this library on how they would go about doing that.

Thanks in advance!

rynti avatar Jun 24 '24 14:06 rynti

hi @rynti , you can use strict: process.env.NODE_ENV !== 'production' to enable strict mode by default in a development build.

For example,

create(
  { count: 0 },
  (draft) => {
    //
  },
  {
    strict: process.env.NODE_ENV !== "production",
  }
);

unadlib avatar Jun 24 '24 16:06 unadlib