feat: typescript 3.6 support (#32946)

BREAKING CHANGE: typescript 3.4 and 3.5 are no longer supported, please update to typescript 3.6

Fixes #32380

PR Close #32946
This commit is contained in:
Igor Minar
2019-10-01 16:44:50 -07:00
committed by Matias Niemelä
parent 117ca7cf39
commit 86e1e6c082
89 changed files with 15550 additions and 5333 deletions

View File

@ -14,7 +14,7 @@
"license": "MIT",
"peerDependencies": {
"rxjs": "^6.5.3",
"tslib": "^1.9.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"repository": {

View File

@ -10,7 +10,7 @@ import {ɵɵdefineBase, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineNgMo
import {ɵɵInheritDefinitionFeature} from './features/inherit_definition_feature';
import {ɵɵNgOnChangesFeature} from './features/ng_onchanges_feature';
import {ɵɵProvidersFeature} from './features/providers_feature';
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveType, PipeDef, ɵɵBaseDef, ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ɵɵFactoryDef, ɵɵPipeDefWithMeta} from './interfaces/definition';
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, PipeDef, ɵɵBaseDef, ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ɵɵFactoryDef, ɵɵPipeDefWithMeta} from './interfaces/definition';
import {getComponent, getDirectives, getHostElement, getRenderedText} from './util/discovery_utils';
export {ComponentFactory, ComponentFactoryResolver, ComponentRef, injectComponentFactoryResolver} from './component_ref';
@ -207,7 +207,6 @@ export {
ComponentTemplate,
ComponentType,
DirectiveDef,
DirectiveDefFlags,
ɵɵDirectiveDefWithMeta,
DirectiveType,
ɵɵNgOnChangesFeature,

View File

@ -83,10 +83,6 @@ export interface DirectiveType<T> extends Type<T> {
ɵfac: () => T;
}
export enum DirectiveDefFlags {
ContentQuery = 0b10
}
/**
* A subclass of `Type` which has a static `ɵpipe`:`PipeDef` field making it
* consumable for rendering.

View File

@ -225,9 +225,7 @@ export function createContainerRef(
ngModuleRef?: viewEngine_NgModuleRef<any>|undefined): viewEngine_ComponentRef<C> {
const contextInjector = injector || this.parentInjector;
if (!ngModuleRef && (componentFactory as any).ngModule == null && contextInjector) {
// FIXME: ngModuleRef is optional, so its type allows "undefined", whereas the code
// below is passing null for the default/absent value.
ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null as any as undefined);
ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null) || undefined;
}
const componentRef =

View File

@ -375,7 +375,7 @@ class SomeComponent {
}, 1);
const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null);
defaultPlatform.injector.get(CompilerFactory, null) !;
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(
createModule([{provide: APP_INITIALIZER, useValue: () => promise, multi: true}]));
defaultPlatform.bootstrapModuleFactory(moduleFactory).then(_ => {
@ -385,7 +385,7 @@ class SomeComponent {
it('should rethrow sync errors even if the exceptionHandler is not rethrowing', async(() => {
const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null);
defaultPlatform.injector.get(CompilerFactory, null) !;
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
[{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true}]));
expect(() => defaultPlatform.bootstrapModuleFactory(moduleFactory)).toThrow('Test');
@ -397,7 +397,7 @@ class SomeComponent {
it('should rethrow promise errors even if the exceptionHandler is not rethrowing',
async(() => {
const compilerFactory: CompilerFactory =
defaultPlatform.injector.get(CompilerFactory, null);
defaultPlatform.injector.get(CompilerFactory, null) !;
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
[{provide: APP_INITIALIZER, useValue: () => Promise.reject('Test'), multi: true}]));
defaultPlatform.bootstrapModuleFactory(moduleFactory)

View File

@ -39,7 +39,6 @@ import {clearRegisteredModuleState} from '../../src/linker/ng_module_factory_reg
let _nextRootElementId = 0;
const UNDEFINED: Symbol = Symbol('UNDEFINED');
/**
* @description
@ -268,7 +267,8 @@ export class TestBedRender3 implements TestBed {
if (token as unknown === TestBedRender3) {
return this as any;
}
const result = this.testModuleRef.injector.get(token, UNDEFINED as{}, flags);
const UNDEFINED = {};
const result = this.testModuleRef.injector.get(token, UNDEFINED, flags);
return result === UNDEFINED ? this.compiler.injector.get(token, notFoundValue, flags) as any :
result;
}

View File

@ -16,9 +16,6 @@ import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBedStatic, Tes
import {TestingCompiler, TestingCompilerFactory} from './test_compiler';
const UNDEFINED = new Object();
let _nextRootElementId = 0;
/**
@ -479,6 +476,7 @@ export class TestBedViewEngine implements TestBed {
}
// Tests can inject things from the ng module and from the compiler,
// but the ng module can't inject things from the compiler and vice versa.
const UNDEFINED = {};
const result = this._moduleRef.injector.get(token, UNDEFINED, flags);
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue, flags) as any :
result;