Type Challenges Judge

Simple Vue

提出詳細

type ToGetter<T extends Record<string, (...arg: any[]) => any>> = { [P in keyof T]: ReturnType<T[P]> } interface VueObject<D, C extends Record<string, (this: D) => unknown>> { data: (this: undefined) => D computed: C methods: Record<string, (this: D & ToGetter<C> & VueObject<D, C>["methods"]) => unknown> } declare function SimpleVue<D, C extends Record<string, (this: D) => unknown>> (options: VueObject<D, C>): any
提出日時2024-09-16 08:56:02
問題Simple Vue
ユーザーookkoouu
ステータスWrong Answer
テストケース
import type { Equal, Expect } from '@type-challenges/utils' SimpleVue({ data() { // @ts-expect-error this.firstname // @ts-expect-error this.getRandom() // @ts-expect-error this.data() return { firstname: 'Type', lastname: 'Challenges', amount: 10, } }, computed: { fullname() { return `${this.firstname} ${this.lastname}` }, }, methods: { getRandom() { return Math.random() }, hi() { alert(this.amount) alert(this.fullname.toLowerCase()) alert(this.getRandom()) }, test() { const fullname = this.fullname const cases: [Expect<Equal<typeof fullname, string>>] = [] as any }, }, })