From f05999730a8d7ab8826ccb6ced89586a6327c256 Mon Sep 17 00:00:00 2001 From: JoostK Date: Fri, 11 Oct 2019 22:20:36 +0200 Subject: [PATCH] build(docs-infra): fix template type check errors (#33066) In #33066 a limitation of Ivy's template type checker was fixed, where all directive inputs would incorrectly allow `undefined` to be passed, even when the input's type did not allow for it. Due to the fix, some additional type errors were uncovered in AIO, where potential `undefined` values would be passed to inputs that were not typed to allow `undefined`. PR Close #33066 --- aio/src/app/custom-elements/code/code.component.ts | 10 +++++----- aio/src/app/layout/nav-item/nav-item.component.ts | 2 +- aio/src/app/layout/nav-menu/nav-menu.component.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aio/src/app/custom-elements/code/code.component.ts b/aio/src/app/custom-elements/code/code.component.ts index 27246ab1d2..fe8b61118f 100644 --- a/aio/src/app/custom-elements/code/code.component.ts +++ b/aio/src/app/custom-elements/code/code.component.ts @@ -63,7 +63,7 @@ export class CodeComponent implements OnChanges { @Input() hideCopy: boolean; /** Language to render the code (e.g. javascript, dart, typescript). */ - @Input() language: string; + @Input() language: string | undefined; /** * Whether to display line numbers: @@ -71,7 +71,7 @@ export class CodeComponent implements OnChanges { * - If true: show * - If number: show but start at that number */ - @Input() linenums: boolean | number | string; + @Input() linenums: boolean | number | string | undefined; /** Path to the source of the code. */ @Input() path: string; @@ -81,12 +81,12 @@ export class CodeComponent implements OnChanges { /** Optional header to be displayed above the code. */ @Input() - set header(header: string) { + set header(header: string | undefined) { this._header = header; this.ariaLabel = this.header ? `Copy code snippet from ${this.header}` : ''; } - get header(): string { return this._header; } - private _header: string; + get header(): string|undefined { return this._header; } + private _header: string | undefined; @Output() codeFormatted = new EventEmitter(); diff --git a/aio/src/app/layout/nav-item/nav-item.component.ts b/aio/src/app/layout/nav-item/nav-item.component.ts index a62612f834..eb9a26d5ba 100644 --- a/aio/src/app/layout/nav-item/nav-item.component.ts +++ b/aio/src/app/layout/nav-item/nav-item.component.ts @@ -10,7 +10,7 @@ export class NavItemComponent implements OnChanges { @Input() level = 1; @Input() node: NavigationNode; @Input() isParentExpanded = true; - @Input() selectedNodes: NavigationNode[]; + @Input() selectedNodes: NavigationNode[] | undefined; isExpanded = false; isSelected = false; diff --git a/aio/src/app/layout/nav-menu/nav-menu.component.ts b/aio/src/app/layout/nav-menu/nav-menu.component.ts index 53194f6c96..b20c338a50 100644 --- a/aio/src/app/layout/nav-menu/nav-menu.component.ts +++ b/aio/src/app/layout/nav-menu/nav-menu.component.ts @@ -8,7 +8,7 @@ import { CurrentNode, NavigationNode } from 'app/navigation/navigation.service'; ` }) export class NavMenuComponent { - @Input() currentNode: CurrentNode; + @Input() currentNode: CurrentNode | undefined; @Input() isWide = false; @Input() nodes: NavigationNode[]; get filteredNodes() { return this.nodes ? this.nodes.filter(n => !n.hidden) : []; }