Bläddra i källkod

fix(topTabs): Add typing for children on TopTabs (#5803)

Albert Alises 4 år sedan
förälder
incheckning
1f611c657f
2 ändrade filer med 17 tillägg och 9 borttagningar
  1. 12
    4
      lib/src/commands/LayoutTreeParser.ts
  2. 5
    5
      lib/src/interfaces/Layout.ts

+ 12
- 4
lib/src/commands/LayoutTreeParser.ts Visa fil

@@ -2,7 +2,7 @@ import { LayoutType } from './LayoutType';
2 2
 import { LayoutNode } from './LayoutTreeCrawler';
3 3
 import {
4 4
   Layout,
5
-  TopTabs,
5
+  LayoutTopTabs,
6 6
   LayoutComponent,
7 7
   LayoutStack,
8 8
   LayoutBottomTabs,
@@ -36,7 +36,7 @@ export class LayoutTreeParser {
36 36
     throw new Error(`unknown LayoutType "${Object.keys(api)}"`);
37 37
   }
38 38
 
39
-  private topTabs(api: TopTabs): LayoutNode {
39
+  private topTabs(api: LayoutTopTabs): LayoutNode {
40 40
     return {
41 41
       id: api.id || this.uniqueIdProvider.generate(LayoutType.TopTabs),
42 42
       type: LayoutType.TopTabs,
@@ -103,7 +103,11 @@ export class LayoutTreeParser {
103 103
     return {
104 104
       id: api.id || this.uniqueIdProvider.generate(LayoutType.Component),
105 105
       type: LayoutType.Component,
106
-      data: { name: api.name.toString(), options: api.options, passProps: api.passProps },
106
+      data: {
107
+        name: api.name.toString(),
108
+        options: api.options,
109
+        passProps: api.passProps
110
+      },
107 111
       children: []
108 112
     };
109 113
   }
@@ -112,7 +116,11 @@ export class LayoutTreeParser {
112 116
     return {
113 117
       id: api.id || this.uniqueIdProvider.generate(LayoutType.ExternalComponent),
114 118
       type: LayoutType.ExternalComponent,
115
-      data: { name: api.name.toString(), options: api.options, passProps: api.passProps },
119
+      data: {
120
+        name: api.name.toString(),
121
+        options: api.options,
122
+        passProps: api.passProps
123
+      },
116 124
       children: []
117 125
     };
118 126
   }

+ 5
- 5
lib/src/interfaces/Layout.ts Visa fil

@@ -46,7 +46,7 @@ export interface LayoutStack {
46 46
   options?: Options;
47 47
 }
48 48
 
49
-export interface LayoutBottomTabsChildren {
49
+export interface LayoutTabsChildren {
50 50
   /**
51 51
    * Set stack
52 52
    */
@@ -70,7 +70,7 @@ export interface LayoutBottomTabs {
70 70
   /**
71 71
    * Set the children screens
72 72
    */
73
-  children?: LayoutBottomTabsChildren[];
73
+  children?: LayoutTabsChildren[];
74 74
   /**
75 75
    * Set the bottom tabs options
76 76
    */
@@ -121,7 +121,7 @@ export interface LayoutSplitView {
121 121
   options?: Options;
122 122
 }
123 123
 
124
-export interface TopTabs {
124
+export interface LayoutTopTabs {
125 125
   /**
126 126
    * Set the layout's id so Navigation.mergeOptions can be used to update options
127 127
    */
@@ -129,7 +129,7 @@ export interface TopTabs {
129 129
   /**
130 130
    * Set the children screens
131 131
    */
132
-  children?: any[];
132
+  children?: LayoutTabsChildren[];
133 133
   /**
134 134
    * Configure top tabs
135 135
    */
@@ -188,7 +188,7 @@ export interface Layout<P = {}> {
188 188
   /**
189 189
    * Set the top tabs
190 190
    */
191
-  topTabs?: TopTabs;
191
+  topTabs?: LayoutTopTabs;
192 192
   /**
193 193
    * Set the external component
194 194
    */