From f7db7f361b6356591781b9f33abbb0d5b7f9b97c Mon Sep 17 00:00:00 2001 From: k-furusho <88301866+k-furusho@users.noreply.github.com> Date: Wed, 9 Nov 2022 18:34:55 +0900 Subject: [PATCH] fix(types): fix spreading VNodeData in tsx (#12789) fix #12778 --- types/test/vue-test.ts | 14 +++++++------- types/vnode.d.ts | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index b792cec583d..fdf37b52abb 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -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 ]) } }) diff --git a/types/vnode.d.ts b/types/vnode.d.ts index 29bdb398c1c..d6f23ec3b67 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -1,3 +1,4 @@ +import { StyleValue } from './jsx' import { Vue } from './vue' import { DirectiveFunction, DirectiveOptions } from './options' import { Ref } from './v3-generated' @@ -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 }