Type Challenges Judge

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:25:59
問題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 }, }, })