build(docs-infra): enable `fullTemplateTypeCheck` (and fix failures) (#32980)

PR Close #32980
This commit is contained in:
George Kalpakas 2019-10-03 17:00:45 +03:00 committed by Miško Hevery
parent b2666a2857
commit a2d2a5d572
7 changed files with 26 additions and 20 deletions

View File

@ -21,9 +21,9 @@
</div> </div>
<article class="api-list-container l-content-small docs-content"> <article class="api-list-container l-content-small docs-content">
<div *ngFor="let section of filteredSections | async" > <div *ngFor="let section of (filteredSections | async)!" >
<h2 *ngIf="section.items"><a [href]="section.path" [class.deprecated-api-item]="section.deprecated">{{section.title}}</a></h2> <h2 *ngIf="section.items"><a [href]="section.path" [class.deprecated-api-item]="section.deprecated">{{section.title}}</a></h2>
<ul class="api-list" *ngIf="section.items?.length"> <ul class="api-list" *ngIf="section.items && section.items.length">
<ng-container *ngFor="let item of section.items"> <ng-container *ngFor="let item of section.items">
<li class="api-item"> <li class="api-item">
<a [href]="item.path" [class.deprecated-api-item]="item.stability === 'deprecated'"> <a [href]="item.path" [class.deprecated-api-item]="item.stability === 'deprecated'">

View File

@ -3,13 +3,14 @@ import { AfterViewInit, Component, ElementRef, Input, OnInit, QueryList, ViewChi
import { CodeComponent } from './code.component'; import { CodeComponent } from './code.component';
export interface TabInfo { export interface TabInfo {
class: string|null; class: string;
code: string; code: string;
language: string|null;
linenums: any;
path: string; path: string;
region: string; region: string;
header: string|null;
header?: string;
language?: string;
linenums?: string;
} }
/** /**
@ -46,7 +47,7 @@ export interface TabInfo {
export class CodeTabsComponent implements OnInit, AfterViewInit { export class CodeTabsComponent implements OnInit, AfterViewInit {
tabs: TabInfo[]; tabs: TabInfo[];
@Input() linenums: string; @Input() linenums: string | undefined;
@ViewChild('content', { static: true }) content: ElementRef<HTMLDivElement>; @ViewChild('content', { static: true }) content: ElementRef<HTMLDivElement>;
@ -70,13 +71,14 @@ export class CodeTabsComponent implements OnInit, AfterViewInit {
/** Gets the extracted TabInfo data from the provided code-pane element. */ /** Gets the extracted TabInfo data from the provided code-pane element. */
private getTabInfo(tabContent: Element): TabInfo { private getTabInfo(tabContent: Element): TabInfo {
return { return {
class: tabContent.getAttribute('class'), class: tabContent.getAttribute('class') || '',
code: tabContent.innerHTML, code: tabContent.innerHTML,
language: tabContent.getAttribute('language'),
linenums: tabContent.getAttribute('linenums') || this.linenums,
path: tabContent.getAttribute('path') || '', path: tabContent.getAttribute('path') || '',
region: tabContent.getAttribute('region') || '', region: tabContent.getAttribute('region') || '',
header: tabContent.getAttribute('header')
header: tabContent.getAttribute('header') || undefined,
language: tabContent.getAttribute('language') || undefined,
linenums: tabContent.getAttribute('linenums') || this.linenums,
}; };
} }
} }

View File

@ -20,7 +20,7 @@ export class TocComponent implements OnInit, AfterViewInit, OnDestroy {
isEmbedded = false; isEmbedded = false;
@ViewChildren('tocItem') private items: QueryList<ElementRef>; @ViewChildren('tocItem') private items: QueryList<ElementRef>;
private onDestroy = new Subject(); private onDestroy = new Subject();
private primaryMax = 4; primaryMax = 4;
tocList: TocItem[]; tocList: TocItem[];
constructor( constructor(

View File

@ -3,8 +3,13 @@
// Then re-export them from `navigation.service.ts` // Then re-export them from `navigation.service.ts`
export interface NavigationNode { export interface NavigationNode {
// NOTE:
// A navigation node should always have a title (to display to the user).
// It may also have `url` (if it is a leaf node) or `children` (and no `url`), but it should
// always have `title`.
title: string;
url?: string; url?: string;
title?: string;
tooltip?: string; tooltip?: string;
hidden?: boolean; hidden?: boolean;
children?: NavigationNode[]; children?: NavigationNode[];

View File

@ -41,8 +41,8 @@ describe('NavigationService', () => {
navService.navigationViews.subscribe(views => viewsEvents.push(views)); navService.navigationViews.subscribe(views => viewsEvents.push(views));
expect(viewsEvents).toEqual([]); expect(viewsEvents).toEqual([]);
httpMock.expectOne({}).flush({ TopBar: [ { url: 'a' }] }); httpMock.expectOne({}).flush({ TopBar: [ { title: '', url: 'a' }] });
expect(viewsEvents).toEqual([{ TopBar: [ { url: 'a' }] }]); expect(viewsEvents).toEqual([{ TopBar: [ { title: '', url: 'a' }] }]);
}); });
it('navigationViews observable should complete', () => { it('navigationViews observable should complete', () => {
@ -82,7 +82,7 @@ describe('NavigationService', () => {
{ title: 'a', tooltip: 'a tip' }, { title: 'a', tooltip: 'a tip' },
{ title: 'b' }, { title: 'b' },
{ title: 'c!'}, { title: 'c!'},
{ url: 'foo' } { title: '', url: 'foo' }
]; ];
beforeEach(() => { beforeEach(() => {

View File

@ -14,7 +14,7 @@ export class SearchResultsComponent implements OnChanges {
* The results to display * The results to display
*/ */
@Input() @Input()
searchResults: SearchResults; searchResults: SearchResults | null = null;
/** /**
* Emitted when the user selects a search result * Emitted when the user selects a search result
@ -39,7 +39,7 @@ export class SearchResultsComponent implements OnChanges {
} }
// Map the search results into groups by area // Map the search results into groups by area
private processSearchResults(search: SearchResults) { private processSearchResults(search: SearchResults | null) {
if (!search) { if (!search) {
return []; return [];
} }

View File

@ -37,8 +37,7 @@
], ],
"angularCompilerOptions": { "angularCompilerOptions": {
"disableTypeScriptVersionCheck": true, "disableTypeScriptVersionCheck": true,
// TODO: Fix template type errors and enable. "fullTemplateTypeCheck": true,
// "fullTemplateTypeCheck": true,
"strictInjectionParameters": true "strictInjectionParameters": true
} }
} }