Closed Rennix09 closed 6 months ago
Resolved this by defining an interface.
import { WritableDraft } from "immer/dist/internal";
interface IFrontend {
... // all the public members here
}
class Frontend implements IFrontend {
private frameworks: string[] = ['React', 'Vue', 'Angular'];
}
const frontend: IFrontend = {} as WritableDraft<IFrontend>;
🙋♂ Question
I got a type error when I tried to wrap a class instance that owns private fields. WhatI should I do?
Code Snippet
Expect: The wrapped type is compatible to the original type
Actual: Property 'frameworks' is missing in type 'WritableDraft' but required in type 'Frontend'.ts(2741)
setUseProxies(true)
setUseProxies(false)
(ES5 only)