Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to make Strict Mode the default #43

Open
rynti opened this issue Jun 24, 2024 · 1 comment
Open

Ability to make Strict Mode the default #43

rynti opened this issue Jun 24, 2024 · 1 comment

Comments

@rynti
Copy link

rynti commented Jun 24, 2024

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!

@unadlib
Copy link
Owner

unadlib commented Jun 24, 2024

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",
  }
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants