build(aio): update to typescript@2.7.2 (#22872)

PR Close #22872
This commit is contained in:
Igor Minar 2018-03-20 00:01:31 -07:00 committed by Matias Niemelä
parent 56e545735c
commit 328511be8e
13 changed files with 23 additions and 32 deletions

View File

@ -146,7 +146,7 @@
"tree-kill": "^1.1.0", "tree-kill": "^1.1.0",
"ts-node": "^3.3.0", "ts-node": "^3.3.0",
"tslint": "~4.5.0", "tslint": "~4.5.0",
"typescript": "^2.5.3", "typescript": "^2.7.2",
"uglify-js": "^3.0.15", "uglify-js": "^3.0.15",
"unist-util-filter": "^0.2.1", "unist-util-filter": "^0.2.1",
"unist-util-source": "^1.0.1", "unist-util-source": "^1.0.1",

View File

@ -49,17 +49,18 @@ describe('ApiService', () => {
describe('#sections', () => { describe('#sections', () => {
it('first subscriber should fetch sections', () => { it('first subscriber should fetch sections', done => {
const data = [{name: 'a', title: 'A', items: []}, {name: 'b', title: 'B', items: []}]; const data = [{name: 'a', title: 'A', items: []}, {name: 'b', title: 'B', items: []}];
service.sections.subscribe(sections => { service.sections.subscribe(sections => {
expect(sections).toEqual(data); expect(sections).toEqual(data);
done();
}); });
httpMock.expectOne({}).flush(data); httpMock.expectOne({}).flush(data);
}); });
it('second subscriber should get previous sections and NOT trigger refetch', () => { it('second subscriber should get previous sections and NOT trigger refetch', done => {
const data = [{name: 'a', title: 'A', items: []}, {name: 'b', title: 'B', items: []}]; const data = [{name: 'a', title: 'A', items: []}, {name: 'b', title: 'B', items: []}];
let subscriptions = 0; let subscriptions = 0;
@ -71,6 +72,8 @@ describe('ApiService', () => {
service.sections.subscribe(sections => { service.sections.subscribe(sections => {
subscriptions++; subscriptions++;
expect(sections).toEqual(data); expect(sections).toEqual(data);
expect(subscriptions).toBe(2);
done();
}); });
httpMock.expectOne({}).flush(data); httpMock.expectOne({}).flush(data);

View File

@ -33,7 +33,6 @@ const FAKE_COMPONENT_FACTORIES = new Map([
describe('ElementsLoader', () => { describe('ElementsLoader', () => {
let elementsLoader: ElementsLoader; let elementsLoader: ElementsLoader;
let injectedModuleRef: NgModuleRef<any>;
let actualCustomElementsDefine; let actualCustomElementsDefine;
let fakeCustomElementsDefine; let fakeCustomElementsDefine;
@ -61,7 +60,6 @@ describe('ElementsLoader', () => {
] ]
}); });
injectedModuleRef = injector.get(NgModuleRef);
elementsLoader = injector.get(ElementsLoader); elementsLoader = injector.get(ElementsLoader);
}); });

View File

@ -14,7 +14,6 @@ describe('ResourceListComponent', () => {
let injector: ReflectiveInjector; let injector: ReflectiveInjector;
let location: TestPlatformLocation; let location: TestPlatformLocation;
let resourceService: TestResourceService;
beforeEach(() => { beforeEach(() => {
injector = ReflectiveInjector.resolveAndCreate([ injector = ReflectiveInjector.resolveAndCreate([
@ -24,7 +23,6 @@ describe('ResourceListComponent', () => {
]); ]);
location = injector.get(PlatformLocation); location = injector.get(PlatformLocation);
resourceService = injector.get(ResourceService);
}); });
it('should set the location w/o leading slashes', () => { it('should set the location w/o leading slashes', () => {

View File

@ -10,7 +10,6 @@ import { FileNotFoundSearchComponent } from './file-not-found-search.component';
describe('FileNotFoundSearchComponent', () => { describe('FileNotFoundSearchComponent', () => {
let element: HTMLElement;
let fixture: ComponentFixture<FileNotFoundSearchComponent>; let fixture: ComponentFixture<FileNotFoundSearchComponent>;
let searchService: SearchService; let searchService: SearchService;
let searchResultSubject: Subject<SearchResults>; let searchResultSubject: Subject<SearchResults>;
@ -30,7 +29,6 @@ describe('FileNotFoundSearchComponent', () => {
searchResultSubject = new Subject<SearchResults>(); searchResultSubject = new Subject<SearchResults>();
spyOn(searchService, 'search').and.callFake(() => searchResultSubject.asObservable()); spyOn(searchService, 'search').and.callFake(() => searchResultSubject.asObservable());
fixture.detectChanges(); fixture.detectChanges();
element = fixture.nativeElement;
}); });
it('should run a search with a query built from the current url', () => { it('should run a search with a query built from the current url', () => {

View File

@ -104,15 +104,15 @@ describe('DocumentService', () => {
}); });
it('should use a hard-coded error doc if the request fails (but not cache it)', () => { it('should use a hard-coded error doc if the request fails (but not cache it)', () => {
let latestDocument: DocumentContents|undefined; let latestDocument!: DocumentContents;
const doc1 = { contents: 'doc 1' }; const doc1 = { contents: 'doc 1' } as DocumentContents;
const doc2 = { contents: 'doc 2' }; const doc2 = { contents: 'doc 2' } as DocumentContents;
const { docService, locationService, logger } = getServices('initial/doc'); const { docService, locationService, logger } = getServices('initial/doc');
docService.currentDocument.subscribe(doc => latestDocument = doc); docService.currentDocument.subscribe(doc => latestDocument = doc);
httpMock.expectOne({}).flush(null, {status: 500, statusText: 'Server Error'}); httpMock.expectOne({}).flush(null, {status: 500, statusText: 'Server Error'});
expect(latestDocument!.id).toEqual(FETCHING_ERROR_ID); expect(latestDocument.id).toEqual(FETCHING_ERROR_ID);
expect(logger.output.error).toEqual([ expect(logger.output.error).toEqual([
[jasmine.any(Error)] [jasmine.any(Error)]
]); ]);
@ -129,14 +129,14 @@ describe('DocumentService', () => {
}); });
it('should not crash the app if the response is invalid JSON', () => { it('should not crash the app if the response is invalid JSON', () => {
let latestDocument: DocumentContents|undefined; let latestDocument!: DocumentContents;
const doc1 = { contents: 'doc 1' }; const doc1 = { contents: 'doc 1' } as DocumentContents;
const { docService, locationService } = getServices('initial/doc'); const { docService, locationService } = getServices('initial/doc');
docService.currentDocument.subscribe(doc => latestDocument = doc); docService.currentDocument.subscribe(doc => latestDocument = doc);
httpMock.expectOne({}).flush('this is invalid JSON'); httpMock.expectOne({}).flush('this is invalid JSON');
expect(latestDocument!.id).toEqual(FETCHING_ERROR_ID); expect(latestDocument.id).toEqual(FETCHING_ERROR_ID);
locationService.go('new/doc'); locationService.go('new/doc');
httpMock.expectOne({}).flush(doc1); httpMock.expectOne({}).flush(doc1);
@ -144,11 +144,11 @@ describe('DocumentService', () => {
}); });
it('should not make a request to the server if the doc is in the cache already', () => { it('should not make a request to the server if the doc is in the cache already', () => {
let latestDocument: DocumentContents|undefined; let latestDocument!: DocumentContents;
let subscription: Subscription; let subscription: Subscription;
const doc0 = { contents: 'doc 0' }; const doc0 = { contents: 'doc 0' } as DocumentContents;
const doc1 = { contents: 'doc 1' }; const doc1 = { contents: 'doc 1' } as DocumentContents;
const { docService, locationService } = getServices('url/0'); const { docService, locationService } = getServices('url/0');
subscription = docService.currentDocument.subscribe(doc => latestDocument = doc); subscription = docService.currentDocument.subscribe(doc => latestDocument = doc);

View File

@ -7,7 +7,6 @@ import { NotificationComponent } from './notification.component';
import { WindowToken } from 'app/shared/window'; import { WindowToken } from 'app/shared/window';
describe('NotificationComponent', () => { describe('NotificationComponent', () => {
let element: HTMLElement;
let component: NotificationComponent; let component: NotificationComponent;
let fixture: ComponentFixture<TestComponent>; let fixture: ComponentFixture<TestComponent>;
@ -26,7 +25,6 @@ describe('NotificationComponent', () => {
function createComponent() { function createComponent() {
fixture = TestBed.createComponent(TestComponent); fixture = TestBed.createComponent(TestComponent);
const debugElement = fixture.debugElement.query(By.directive(NotificationComponent)); const debugElement = fixture.debugElement.query(By.directive(NotificationComponent));
element = debugElement.nativeElement;
component = debugElement.componentInstance; component = debugElement.componentInstance;
component.ngOnInit(); component.ngOnInit();
fixture.detectChanges(); fixture.detectChanges();

View File

@ -246,12 +246,10 @@ describe('TocComponent', () => {
describe('when in side panel (not embedded)', () => { describe('when in side panel (not embedded)', () => {
let fixture: ComponentFixture<HostNotEmbeddedTocComponent>; let fixture: ComponentFixture<HostNotEmbeddedTocComponent>;
let scrollToTopSpy: jasmine.Spy;
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(HostNotEmbeddedTocComponent); fixture = TestBed.createComponent(HostNotEmbeddedTocComponent);
scrollToTopSpy = TestBed.get(ScrollService).scrollToTop;
tocComponentDe = fixture.debugElement.children[0]; tocComponentDe = fixture.debugElement.children[0];
tocComponent = tocComponentDe.componentInstance; tocComponent = tocComponentDe.componentInstance;
tocService = TestBed.get(TocService); tocService = TestBed.get(TocService);

View File

@ -21,14 +21,14 @@ describe('logger service', () => {
describe('log', () => { describe('log', () => {
it('should delegate to console.log', () => { it('should delegate to console.log', () => {
logger.log('param1', 'param2', 'param3'); logger.log('param1', 'param2', 'param3');
expect(console.log).toHaveBeenCalledWith('param1', 'param2', 'param3'); expect(logSpy).toHaveBeenCalledWith('param1', 'param2', 'param3');
}); });
}); });
describe('warn', () => { describe('warn', () => {
it('should delegate to console.warn', () => { it('should delegate to console.warn', () => {
logger.warn('param1', 'param2', 'param3'); logger.warn('param1', 'param2', 'param3');
expect(console.warn).toHaveBeenCalledWith('param1', 'param2', 'param3'); expect(warnSpy).toHaveBeenCalledWith('param1', 'param2', 'param3');
}); });
}); });

View File

@ -8,7 +8,6 @@ const options = [
{ title: 'Option B', value: 'option-b' } { title: 'Option B', value: 'option-b' }
]; ];
let component: SelectComponent;
let host: HostComponent; let host: HostComponent;
let fixture: ComponentFixture<HostComponent>; let fixture: ComponentFixture<HostComponent>;
let element: DebugElement; let element: DebugElement;
@ -25,7 +24,6 @@ describe('SelectComponent', () => {
fixture = TestBed.createComponent(HostComponent); fixture = TestBed.createComponent(HostComponent);
host = fixture.componentInstance; host = fixture.componentInstance;
element = fixture.debugElement.query(By.directive(SelectComponent)); element = fixture.debugElement.query(By.directive(SelectComponent));
component = element.componentInstance;
}); });
describe('(initially)', () => { describe('(initially)', () => {

View File

@ -3,6 +3,10 @@
"compilerOptions": { "compilerOptions": {
"strict": true, "strict": true,
"noImplicitAny": false, "noImplicitAny": false,
// disabled because this is on by default in tsc 2.7 breaking our codebase - we need to refactor
"strictPropertyInitialization": false,
// disabled because of https://github.com/angular/angular/issues/22877
"skipLibCheck": true,
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"baseUrl": "src", "baseUrl": "src",
"sourceMap": true, "sourceMap": true,

View File

@ -8805,11 +8805,7 @@ typescript@^2.4.1, typescript@~2.6.2:
version "2.6.2" version "2.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4"
typescript@^2.5.3: typescript@^2.7.2, typescript@~2.7.1:
version "2.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.3.tgz#df3dcdc38f3beb800d4bc322646b04a3f6ca7f0d"
typescript@~2.7.1:
version "2.7.2" version "2.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"