Simple Vue
提出詳細
type Computed<T> = { [K in keyof T]: T[K] extends (...args: any) => infer R ? R : never } declare function SimpleVue<D, C, M>(options: { data: (this: {}) => D, computed: C & ThisType<D & Computed<C>>, methods: M & ThisType<D & Computed<C> & M> }): void
提出日時 | 2023-08-14 09:24:51 |
---|---|
問題 | Simple Vue |
ユーザー | tekihei2317 |
ステータス | 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 }, }, })