馃檵鈥嶁檪 Question
A clear and concise description of what the question is. In general we recommend to use Stack Overflow for questions. Questions typically are processed with less priority.
import { produce } from 'immer';
const func = produce((state: Record<string, string> = {}): Record<string, string> => {
return state;
});
In the above code, I expect the type of the func to be Record<string, string>, but the actual type check returns Record<string, string> | undefined, how can I avoid the undefined?

This problem only occurs in 9.x versions
Link to repro
https://codesandbox.io/s/immer-sandbox-forked-n1okz2?file=/src/index.ts
Environment
We only accept questions against the latest Immer version.
馃檵鈥嶁檪 Question
A clear and concise description of what the question is. In general we recommend to use Stack Overflow for questions. Questions typically are processed with less priority.
In the above code, I expect the type of the func to be
Record<string, string>, but the actual type check returnsRecord<string, string> | undefined, how can I avoid the undefined?This problem only occurs in 9.x versions
Link to repro
https://codesandbox.io/s/immer-sandbox-forked-n1okz2?file=/src/index.ts
Environment
We only accept questions against the latest Immer version.
setUseProxies(true)setUseProxies(false)(ES5 only)