Type Challenges Judge

Simple Vue

提出詳細

type GetComputed<C> = { [K in keyof C]: C[K] extends (...args: any) => any ? ReturnType<C[K]> : never } declare function SimpleVue<D,C,M>( options: { data: () => D, computed: C & ThisType<D&C>, methods: M & ThisType<D&GetComputed<C>&M> } & ThisType<{}> ): any
提出日時2023-09-18 14:25:45
問題Simple Vue
ユーザーsankantsu
ステータス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 }, }, })