Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6 - 简单的 Vue 类型 #20969

Open
so11y opened this issue Dec 22, 2022 · 0 comments
Open

6 - 简单的 Vue 类型 #20969

so11y opened this issue Dec 22, 2022 · 0 comments
Labels
6 answer Share answers/solutions to a question zh-CN 简体中文

Comments

@so11y
Copy link

so11y commented Dec 22, 2022

type RecordFunction = Record<string,Function>;
type TransitionComputed<T extends RecordFunction> = {
  [P in keyof T]:T[P] extends ()=>infer A ? A :never
};
type Vue<
Data extends Record<string,any>,
Computed extends RecordFunction,
Methods  extends RecordFunction,
>  = {
  data?():Data;
  computed?: Computed & ThisType<Methods & TransitionComputed<Computed> & Data>,
  methods?: Methods & ThisType<Methods & TransitionComputed<Computed> & Data>,
}

declare function SimpleVue<
Data extends Record<string,any>,
Computed extends RecordFunction,
Methods  extends RecordFunction,
>(options: Vue<Data,Computed,Methods>): any
@so11y so11y added answer Share answers/solutions to a question zh-CN 简体中文 labels Dec 22, 2022
@github-actions github-actions bot added the 6 label Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6 answer Share answers/solutions to a question zh-CN 简体中文
Projects
None yet
Development

No branches or pull requests

1 participant