Skip to content

Commit

Permalink
fix(all): update types to be required (#16218)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Nov 3, 2018
1 parent a981116 commit 091625d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 41 deletions.
22 changes: 11 additions & 11 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ export namespace Components {
/**
* The display type of the menu. Available options: `"overlay"`, `"reveal"`, `"push"`.
*/
'type': string;
'type'?: string;
}
interface IonMenuAttributes extends StencilHTMLAttributes {
/**
Expand Down Expand Up @@ -2611,7 +2611,7 @@ export namespace Components {
/**
* The display type of the menu. Available options: `"overlay"`, `"reveal"`, `"push"`.
*/
'type': string;
'type'?: string;
}

interface IonModalController {
Expand Down Expand Up @@ -3632,23 +3632,23 @@ export namespace Components {
*/
'from': string;
/**
* A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perfom a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches.
* A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perform a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches.
*/
'to'?: string;
'to': string | undefined | null;
}
interface IonRouteRedirectAttributes extends StencilHTMLAttributes {
/**
* A redirect route, redirects "from" a URL "to" another URL. This property is that "from" URL. It needs to be an exact match of the navigated URL in order to apply. The path specified in this value is always an absolute path, even if the initial `/` slash is not specified.
*/
'from'?: string;
'from': string;
/**
* Internal event that fires when any value of this rule is added/removed from the DOM, or any of his public properties changes. `ion-router` captures this event in order to update his internal registry of router rules.
*/
'onIonRouteRedirectChanged'?: (event: CustomEvent) => void;
/**
* A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perfom a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches.
* A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perform a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches.
*/
'to'?: string;
'to': string | undefined | null;
}

interface IonRoute {
Expand Down Expand Up @@ -4504,7 +4504,7 @@ export namespace Components {
/**
* A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them.
*/
'tab'?: string;
'tab': string;
}
interface IonTabButtonAttributes extends StencilHTMLAttributes {
/**
Expand Down Expand Up @@ -4534,7 +4534,7 @@ export namespace Components {
/**
* A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them.
*/
'tab'?: string;
'tab': string;
}

interface IonTab {
Expand All @@ -4551,7 +4551,7 @@ export namespace Components {
/**
* A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them.
*/
'tab'?: string;
'tab': string;
}
interface IonTabAttributes extends StencilHTMLAttributes {
'active'?: boolean;
Expand All @@ -4563,7 +4563,7 @@ export namespace Components {
/**
* A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them.
*/
'tab'?: string;
'tab': string;
}

interface IonTabs {
Expand Down
10 changes: 6 additions & 4 deletions core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class Menu implements ComponentInterface, MenuI {
* The display type of the menu.
* Available options: `"overlay"`, `"reveal"`, `"push"`.
*/
@Prop({ mutable: true }) type!: string;
@Prop({ mutable: true }) type?: string;

@Watch('type')
typeChanged(type: string, oldType: string | undefined) {
Expand Down Expand Up @@ -143,7 +143,9 @@ export class Menu implements ComponentInterface, MenuI {
@Event() protected ionMenuChange!: EventEmitter<MenuChangeEventDetail>;

async componentWillLoad() {
this.type = this.type || this.config.get('menuType', this.mode === 'ios' ? 'reveal' : 'overlay');
if (this.type === undefined) {
this.type = this.config.get('menuType', this.mode === 'ios' ? 'reveal' : 'overlay');
}

if (this.isServer) {
this.disabled = true;
Expand All @@ -169,7 +171,7 @@ export class Menu implements ComponentInterface, MenuI {
// add menu's content classes
content.classList.add('menu-content');

this.typeChanged(this.type, undefined);
this.typeChanged(this.type!, undefined);
this.sideChanged();

// register this menu with the app's menu controller
Expand Down Expand Up @@ -313,7 +315,7 @@ export class Menu implements ComponentInterface, MenuI {
this.animation = undefined;
}
// Create new animation
this.animation = await this.menuCtrl!._createAnimation(this.type, this);
this.animation = await this.menuCtrl!._createAnimation(this.type!, this);
}

private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/menu/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ These can be controlled from the templates, or programmatically using the MenuCo
| `menuId` | `menu-id` | An id for the menu. | `string \| undefined` | `undefined` |
| `side` | `side` | Which side of the view the menu should be placed. | `"end" \| "start"` | `'start'` |
| `swipeGesture` | `swipe-gesture` | If `true`, swiping the menu is enabled. | `boolean` | `true` |
| `type` | `type` | The display type of the menu. Available options: `"overlay"`, `"reveal"`, `"push"`. | `string` | `undefined` |
| `type` | `type` | The display type of the menu. Available options: `"overlay"`, `"reveal"`, `"push"`. | `string \| undefined` | `undefined` |


## Events
Expand Down
12 changes: 6 additions & 6 deletions core/src/components/route-redirect/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This route has only two configurable values:
- `from`
- `to`

Their meaning is obvious under the context of a redirection, that ocurrs `from` a given URL `to` another given URL.
Their meaning is obvious under the context of a redirection, that occurs `from` a given URL `to` another given URL.

In other for a redirection to occurs the `from` path needs to be an exact match of the navigated URL.

Expand All @@ -29,7 +29,7 @@ Let's say we have this two redirection rules:

And the user navigates to `/admin`. The router will then redirect to `/login` and stop there.

It WILL NOT never evalute more than one redirection rule in a roll.
It WILL NOT never evaluate more than one redirection rule in a roll.


## Examples
Expand Down Expand Up @@ -71,10 +71,10 @@ Another approach is to modify the value of `to`, since given `to` the value of `

## Properties

| Property | Attribute | Description | Type | Default |
| -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----------- |
| `from` | `from` | A redirect route, redirects "from" a URL "to" another URL. This property is that "from" URL. It needs to be an exact match of the navigated URL in order to apply. The path specified in this value is always an absolute path, even if the initial `/` slash is not specified. | `string` | `''` |
| `to` | `to` | A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perfom a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches. | `string \| undefined` | `undefined` |
| Property | Attribute | Description | Type | Default |
| -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- | ----------- |
| `from` | `from` | A redirect route, redirects "from" a URL "to" another URL. This property is that "from" URL. It needs to be an exact match of the navigated URL in order to apply. The path specified in this value is always an absolute path, even if the initial `/` slash is not specified. | `string` | `undefined` |
| `to` | `to` | A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL. When the defined `ion-route-redirect` rule matches, the router will redirect to the path specified in this property. The value of this property is always an absolute path inside the scope of routes defined in `ion-router` it can't be used with another router or to perform a redirection to a different domain. Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's a redirect inside the context of ion-router. When this property is not specified or his value is `undefined` the whole redirect route is noop, even if the "from" value matches. | `null \| string \| undefined` | `undefined` |


## Events
Expand Down
6 changes: 3 additions & 3 deletions core/src/components/route-redirect/route-redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ export class RouteRedirect implements ComponentInterface {
* is not specified.
*
*/
@Prop() from = '';
@Prop() from!: string;

/**
* A redirect route, redirects "from" a URL "to" another URL. This property is that "to" URL.
* When the defined `ion-route-redirect` rule matches, the router will redirect to the path
* specified in this property.
*
* The value of this property is always an absolute path inside the scope of routes defined in
* `ion-router` it can't be used with another router or to perfom a redirection to a different domain.
* `ion-router` it can't be used with another router or to perform a redirection to a different domain.
*
* Note that this is a virtual redirect, it will not cause a real browser refresh, again, it's
* a redirect inside the context of ion-router.
*
* When this property is not specified or his value is `undefined` the whole redirect route is noop,
* even if the "from" value matches.
*/
@Prop() to?: string;
@Prop() to!: string | undefined | null;

/**
* Internal event that fires when any value of this rule is added/removed from the DOM,
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/router/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function writeNavState(
// find next navigation outlet in the DOM
const outlet = searchNavNode(root);

// make sure we can continue interating the DOM, otherwise abort
// make sure we can continue interacting the DOM, otherwise abort
if (index >= chain.length || !outlet) {
return changed;
}
Expand All @@ -29,7 +29,7 @@ export async function writeNavState(
changed = true;
}

// recursivelly set nested outlets
// recursively set nested outlets
changed = await writeNavState(result.element, chain, intent, index + 1, changed);

// once all nested outlets are visible let's make the parent visible too,
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/tab-bar/tab-bar-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export interface TabBarChangedDetail {
}

export interface TabButtonClickDetail {
tab?: string;
tab: string;
href?: string;
}
2 changes: 1 addition & 1 deletion core/src/components/tab-button/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the [Tabs API Docs](../Tabs/) for more details on configuring Tabs.
| `href` | `href` | The URL which will be used as the `href` within this tab's button anchor. | `string \| undefined` | `undefined` |
| `layout` | `layout` | Set the layout of the text and icon in the tab bar. It defaults to `'icon-top'`. | `"icon-bottom" \| "icon-end" \| "icon-hide" \| "icon-start" \| "icon-top" \| "label-hide" \| undefined` | `undefined` |
| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` |
| `tab` | `tab` | A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them. | `string \| undefined` | `undefined` |
| `tab` | `tab` | A tab id must be provided for each `ion-tab`. It's used internally to reference the selected tab or by the router to switch between them. | `string` | `undefined` |


----------------------------------------------
Expand Down
6 changes: 1 addition & 5 deletions core/src/components/tab-button/tab-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TabButton implements ComponentInterface {
* A tab id must be provided for each `ion-tab`. It's used internally to reference
* the selected tab or by the router to switch between them.
*/
@Prop() tab?: string;
@Prop() tab!: string;

/**
* The selected tab component
Expand Down Expand Up @@ -84,10 +84,6 @@ export class TabButton implements ComponentInterface {
if (this.layout === undefined) {
this.layout = this.config.get('tabButtonLayout', 'icon-top');
}
if (this.tab === undefined) {
console.warn(`ion-tab-button needs a tab name, so it can be selected.
<ion-tab-button tab="TAB_NAME">`);
}
}

private get hasLabel() {
Expand Down
Loading

0 comments on commit 091625d

Please sign in to comment.