Browse Source

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

Albert Alises 4 years ago
parent
commit
1f611c657f
2 changed files with 17 additions and 9 deletions
  1. 12
    4
      lib/src/commands/LayoutTreeParser.ts
  2. 5
    5
      lib/src/interfaces/Layout.ts

+ 12
- 4
lib/src/commands/LayoutTreeParser.ts View File

2
 import { LayoutNode } from './LayoutTreeCrawler';
2
 import { LayoutNode } from './LayoutTreeCrawler';
3
 import {
3
 import {
4
   Layout,
4
   Layout,
5
-  TopTabs,
5
+  LayoutTopTabs,
6
   LayoutComponent,
6
   LayoutComponent,
7
   LayoutStack,
7
   LayoutStack,
8
   LayoutBottomTabs,
8
   LayoutBottomTabs,
36
     throw new Error(`unknown LayoutType "${Object.keys(api)}"`);
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
     return {
40
     return {
41
       id: api.id || this.uniqueIdProvider.generate(LayoutType.TopTabs),
41
       id: api.id || this.uniqueIdProvider.generate(LayoutType.TopTabs),
42
       type: LayoutType.TopTabs,
42
       type: LayoutType.TopTabs,
103
     return {
103
     return {
104
       id: api.id || this.uniqueIdProvider.generate(LayoutType.Component),
104
       id: api.id || this.uniqueIdProvider.generate(LayoutType.Component),
105
       type: LayoutType.Component,
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
       children: []
111
       children: []
108
     };
112
     };
109
   }
113
   }
112
     return {
116
     return {
113
       id: api.id || this.uniqueIdProvider.generate(LayoutType.ExternalComponent),
117
       id: api.id || this.uniqueIdProvider.generate(LayoutType.ExternalComponent),
114
       type: LayoutType.ExternalComponent,
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
       children: []
124
       children: []
117
     };
125
     };
118
   }
126
   }

+ 5
- 5
lib/src/interfaces/Layout.ts View File

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