Skip to content

Instantly share code, notes, and snippets.

View satouriko's full-sized avatar
🍫
Happy Sugar Life

砂糖梨子 satouriko

🍫
Happy Sugar Life
View GitHub Profile
@satouriko
satouriko / modelToAttrs.ts
Created December 1, 2023 01:32
已经 mutable 还跟个傻逼一样假装单向数据流
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Ref, UnwrapNestedRefs, reactive } from 'vue';
import { ToComputedRefs, toComputedRefs } from './toComputedRefs';
type Model<T extends object, K extends object> = {
state: Ref<T>;
getters: {
[key in keyof K]: K[key] | Ref<K[key]>;
};