Ver código fonte

types(runtime-vapor): add $props type for JSX to detect props types (#14398)

zhiyuanzmj 2 meses atrás
pai
commit
6effe941e8

+ 2 - 2
packages-private/dts-test/vapor/jsx.d.ts

@@ -4,10 +4,10 @@ declare global {
   namespace JSX {
     export type Element = VaporRenderResult
     export interface ElementClass {
-      props: {}
+      $props: {}
     }
     export interface ElementAttributesProperty {
-      props: {}
+      $props: {}
     }
     export interface IntrinsicElements extends NativeElements {
       [name: string]: any

+ 6 - 0
packages/runtime-vapor/src/component.ts

@@ -635,6 +635,12 @@ export class VaporComponentInstance<
    */
   accessedAttrs: boolean = false
 
+  // type only
+  /**
+   * @deprecated only used for JSX to detect props types.
+   */
+  $props!: Props
+
   constructor(
     comp: VaporComponent,
     rawProps?: RawProps | null,