Przeglądaj źródła

fix(types): make render option in functional components to optional (#7663)

katashin 8 lat temu
rodzic
commit
b2092dbff9
2 zmienionych plików z 5 dodań i 1 usunięć
  1. 1 1
      types/options.d.ts
  2. 4 0
      types/test/options-test.ts

+ 1 - 1
types/options.d.ts

@@ -110,7 +110,7 @@ export interface FunctionalComponentOptions<Props = DefaultProps, PropDefs = Pro
   props?: PropDefs;
   inject?: InjectOptions;
   functional: boolean;
-  render(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode;
+  render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode;
 }
 
 export interface RenderContext<Props=DefaultProps> {

+ 4 - 0
types/test/options-test.ts

@@ -331,6 +331,10 @@ Vue.component('functional-component-object-inject', {
   }
 })
 
+Vue.component('functional-component-check-optional', {
+  functional: true
+})
+
 Vue.component("async-component", ((resolve, reject) => {
   setTimeout(() => {
     resolve(Vue.component("component"));