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 }, }, })