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
This commit is contained in:
JoostK 2019-10-11 22:20:36 +02:00 committed by Miško Hevery
parent ece0b2d7ce
commit f05999730a
3 changed files with 7 additions and 7 deletions

View File

@ -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<void>();

View File

@ -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;

View File

@ -8,7 +8,7 @@ import { CurrentNode, NavigationNode } from 'app/navigation/navigation.service';
</aio-nav-item>`
})
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) : []; }