Skip to content

Commit

Permalink
fix(types): fix spreading VNodeData in tsx (vuejs#12789)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-furusho authored Nov 9, 2022
1 parent 0b3cf7d commit f7db7f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions types/test/vue-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,21 @@ obj.a++
const ComponentWithStyleInVNodeData = Vue.extend({
render(h) {
const elementWithStyleAsString = h('div', {
style: 'background-color: red;'
style: '--theme-color: black;'
})

const elementWithStyleAsObject = h('div', {
style: { backgroundColor: 'green' }
const elementWithStyleCSSProperties = h('div', {
style: { ['--theme-color' as any]: 'black' }
})

const elementWithStyleAsArrayOfObjects = h('div', {
style: [{ backgroundColor: 'blue' }]
const elementWithStyleAsArrayOfStyleValues = h('div', {
style: [{ ['--theme-color' as any]: 'black' }]
})

return h('div', undefined, [
elementWithStyleAsString,
elementWithStyleAsObject,
elementWithStyleAsArrayOfObjects
elementWithStyleCSSProperties,
elementWithStyleAsArrayOfStyleValues
])
}
})
Expand Down
3 changes: 2 additions & 1 deletion types/vnode.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { StyleValue } from './jsx'
import { Vue } from './vue'
import { DirectiveFunction, DirectiveOptions } from './options'
import { Ref } from './v3-generated'
Expand Down Expand Up @@ -85,7 +86,7 @@ export interface VNodeData {
staticClass?: string
class?: any
staticStyle?: { [key: string]: any }
style?: string | object[] | object
style?: StyleValue
props?: { [key: string]: any }
attrs?: { [key: string]: any }
domProps?: { [key: string]: any }
Expand Down

0 comments on commit f7db7f3

Please sign in to comment.