import { Checking, type Test } from "hry-types"; import type { ReadonlyDeep } from "hry-types/src/Any/_api"; import type { SpecificType } from "../../../../types/SpecificType"; import { RootComponent } from "../.."; import { type Mock_User } from "../../Properties/expected/normalRequired"; /** * 1 computed字段时需要手写类型,可悬停鼠标到key查看类型,深度只读 */ RootComponent()({ properties: { Pnum: Number, obj: Object as SpecificType, }, data: { DNum: 123, }, computed: { CNum() { return this.data.Pnum + this.data.DNum; }, Cobj() { return this.data.obj; }, }, watch: { CNum(newValue: number, oldValue: number) { Checking; Checking; }, Cobj(newValue: ReadonlyDeep, oldValue: ReadonlyDeep | null) { Checking, typeof newValue, Test.Pass>; Checking | null, typeof oldValue, Test.Pass>; }, }, });