Closed franckXu closed 1 year ago
import { define, observable } from "@formily/reactive"; class Todo { private loading: boolean; constructor() { define(this, { loading: observable.ref // <<< ts不允许annotations私有属性,,但我不想外部修改loading字段, // https://mobx.js.org/observable-state.html#limitations的第8点,有解决方法,formily/reactive有类似的实现吗? // By default TypeScript will not allow you to annotate private fields. This can be overcome by explicitly passing the relevant // private fields as generic argument, like this: makeObservable<MyStore, "privateField" | "privateField2">(this, { privateField: // observable, privateField2: observable }) }); } fetch() { this.loading = true; // ...... this.loading = false; } }
无
@formily/reactive@2.2.15
不支持
Reproduction link
Steps to reproduce
What is expected?
无
What is actually happening?
无
Package
@formily/reactive@2.2.15