A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue-next/commit/9b160b940555abb6b6ce722fddbd9649ee196f7b below:

declared prop keys should always exist in `props` argumen… · vuejs/core@9b160b9 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+54

-5

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+54

-5

lines changed Original file line number Diff line number Diff line change

@@ -65,7 +65,7 @@ import {

65 65

import { warn } from './warning'

66 66

import { VNodeChild } from './vnode'

67 67

import { callWithAsyncErrorHandling } from './errorHandling'

68 -

import { UnionToIntersection } from './helpers/typeUtils'

68 +

import { LooseRequired, UnionToIntersection } from './helpers/typeUtils'

69 69

import { deepMergeData } from './compat/data'

70 70

import { DeprecationTypes } from './compat/compatConfig'

71 71

import {

@@ -130,9 +130,13 @@ export interface ComponentOptionsBase<

130 130

ComponentCustomOptions {

131 131

setup?: (

132 132

this: void,

133 -

props: Props &

134 -

UnionToIntersection<ExtractOptionProp<Mixin>> &

135 -

UnionToIntersection<ExtractOptionProp<Extends>>,

133 +

props: Readonly<

134 +

LooseRequired<

135 +

Props &

136 +

UnionToIntersection<ExtractOptionProp<Mixin>> &

137 +

UnionToIntersection<ExtractOptionProp<Extends>>

138 +

>

139 +

>,

136 140

ctx: SetupContext<E>

137 141

) => Promise<RawBindings> | RawBindings | RenderFunction | void

138 142

name?: string

Original file line number Diff line number Diff line change

@@ -3,3 +3,6 @@ export type UnionToIntersection<U> = (U extends any

3 3

: never) extends ((k: infer I) => void)

4 4

? I

5 5

: never

6 + 7 +

// make keys required but keep undefined values

8 +

export type LooseRequired<T> = { [P in string & keyof T]: T[P] }

Original file line number Diff line number Diff line change

@@ -9,7 +9,8 @@ import {

9 9

expectType,

10 10

ShallowUnwrapRef,

11 11

FunctionalComponent,

12 -

ComponentPublicInstance

12 +

ComponentPublicInstance,

13 +

toRefs

13 14

} from './index'

14 15 15 16

declare function extractComponentOptions<Props, RawBindings>(

@@ -42,6 +43,27 @@ describe('object props', () => {

42 43

object?: object

43 44

}

44 45 46 +

interface ExpectedRefs {

47 +

a: Ref<number | undefined>

48 +

b: Ref<string>

49 +

e: Ref<Function | undefined>

50 +

bb: Ref<string>

51 +

bbb: Ref<string>

52 +

cc: Ref<string[] | undefined>

53 +

dd: Ref<{ n: 1 }>

54 +

ee: Ref<(() => string) | undefined>

55 +

ff: Ref<((a: number, b: string) => { a: boolean }) | undefined>

56 +

ccc: Ref<string[] | undefined>

57 +

ddd: Ref<string[]>

58 +

eee: Ref<() => { a: string }>

59 +

fff: Ref<(a: number, b: string) => { a: boolean }>

60 +

hhh: Ref<boolean>

61 +

ggg: Ref<'foo' | 'bar'>

62 +

ffff: Ref<(a: number, b: string) => { a: boolean }>

63 +

validated: Ref<string | undefined>

64 +

object: Ref<object | undefined>

65 +

}

66 + 45 67

describe('defineComponent', () => {

46 68

const MyComponent = defineComponent({

47 69

props: {

@@ -111,6 +133,26 @@ describe('object props', () => {

111 133

object: Object as PropType<object>

112 134

},

113 135

setup(props) {

136 +

const refs = toRefs(props)

137 +

expectType<ExpectedRefs['a']>(refs.a)

138 +

expectType<ExpectedRefs['b']>(refs.b)

139 +

expectType<ExpectedRefs['e']>(refs.e)

140 +

expectType<ExpectedRefs['bb']>(refs.bb)

141 +

expectType<ExpectedRefs['bbb']>(refs.bbb)

142 +

expectType<ExpectedRefs['cc']>(refs.cc)

143 +

expectType<ExpectedRefs['dd']>(refs.dd)

144 +

expectType<ExpectedRefs['ee']>(refs.ee)

145 +

expectType<ExpectedRefs['ff']>(refs.ff)

146 +

expectType<ExpectedRefs['ccc']>(refs.ccc)

147 +

expectType<ExpectedRefs['ddd']>(refs.ddd)

148 +

expectType<ExpectedRefs['eee']>(refs.eee)

149 +

expectType<ExpectedRefs['fff']>(refs.fff)

150 +

expectType<ExpectedRefs['hhh']>(refs.hhh)

151 +

expectType<ExpectedRefs['ggg']>(refs.ggg)

152 +

expectType<ExpectedRefs['ffff']>(refs.ffff)

153 +

expectType<ExpectedRefs['validated']>(refs.validated)

154 +

expectType<ExpectedRefs['object']>(refs.object)

155 + 114 156

return {

115 157

setupA: 1,

116 158

setupB: ref(1),

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4