build: TypeScript 3.6 compatibility. (#32908)
This PR updates Angular to compile with TypeScript 3.6 while retaining compatibility with TS3.5. We achieve this by inserting several `as any` casts for compatiblity around `ts.CompilerHost` APIs. PR Close #32908
This commit is contained in:
@ -277,7 +277,7 @@ export class PlatformRef {
|
||||
const ngZoneInjector = Injector.create(
|
||||
{providers: providers, parent: this.injector, name: moduleFactory.moduleType.name});
|
||||
const moduleRef = <InternalNgModuleRef<M>>moduleFactory.create(ngZoneInjector);
|
||||
const exceptionHandler: ErrorHandler = moduleRef.injector.get(ErrorHandler, null);
|
||||
const exceptionHandler: ErrorHandler|null = moduleRef.injector.get(ErrorHandler, null);
|
||||
if (!exceptionHandler) {
|
||||
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
||||
}
|
||||
|
@ -81,7 +81,9 @@ export interface DirectiveType<T> extends Type<T> {
|
||||
ngFactoryDef: () => T;
|
||||
}
|
||||
|
||||
export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||
export enum DirectiveDefFlags {
|
||||
ContentQuery = 0b10
|
||||
}
|
||||
|
||||
/**
|
||||
* A subclass of `Type` which has a static `ngPipeDef`:`PipeDef` field making it
|
||||
|
@ -225,7 +225,9 @@ export function createContainerRef(
|
||||
ngModuleRef?: viewEngine_NgModuleRef<any>|undefined): viewEngine_ComponentRef<C> {
|
||||
const contextInjector = injector || this.parentInjector;
|
||||
if (!ngModuleRef && (componentFactory as any).ngModule == null && contextInjector) {
|
||||
ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null);
|
||||
// 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);
|
||||
}
|
||||
|
||||
const componentRef =
|
||||
|
Reference in New Issue
Block a user