Просмотр исходного кода

fix(types): allow slot attribute

close #12617
Evan You 3 лет назад
Родитель
Сommit
94ccca207c
2 измененных файлов с 8 добавлено и 0 удалено
  1. 6 0
      types/jsx.d.ts
  2. 2 0
      types/test/v3/tsx-test.tsx

+ 6 - 0
types/jsx.d.ts

@@ -1303,6 +1303,12 @@ type EventHandlers<E> = {
 type ReservedProps = {
 type ReservedProps = {
   key?: string | number | symbol
   key?: string | number | symbol
   ref?: VNodeData['ref']
   ref?: VNodeData['ref']
+  /**
+   * @deprecated Old named slot syntax has been deprecated, use the new syntax
+   * instead: `<template v-slot:name>`
+   * https://v2.vuejs.org/v2/guide/components-slots.html#Named-Slots
+   */
+  slot?: string
 }
 }
 
 
 type ElementAttrs<T> = T & ReservedProps
 type ElementAttrs<T> = T & ReservedProps

+ 2 - 0
types/test/v3/tsx-test.tsx

@@ -51,3 +51,5 @@ const Foo = defineComponent({
 // working
 // working
 ;<Foo bar={1} />
 ;<Foo bar={1} />
 ;<Foo bar={1} foo="baz" />
 ;<Foo bar={1} foo="baz" />
+
+;<div slot="x" />