fix: turn on nullability in the code base.
This commit is contained in:

committed by
Tobias Bosch

parent
728c9d0632
commit
5293794316
@ -437,7 +437,7 @@ export class MockStaticSymbolResolverHost implements StaticSymbolResolverHost {
|
||||
return baseName + '.d.ts';
|
||||
}
|
||||
if (modulePath == 'unresolved') {
|
||||
return undefined;
|
||||
return undefined !;
|
||||
}
|
||||
return '/tmp/' + modulePath + '.d.ts';
|
||||
}
|
||||
|
@ -366,9 +366,9 @@ export class MockAotCompilerHost implements AotCompilerHost {
|
||||
tsFilesOnly() { this.dtsAreSource = false; }
|
||||
|
||||
// StaticSymbolResolverHost
|
||||
getMetadataFor(modulePath: string): {[key: string]: any}[]|null {
|
||||
getMetadataFor(modulePath: string): {[key: string]: any}[]|undefined {
|
||||
if (!this.tsHost.fileExists(modulePath)) {
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
if (DTS.test(modulePath)) {
|
||||
if (this.metadataVisible) {
|
||||
@ -383,7 +383,7 @@ export class MockAotCompilerHost implements AotCompilerHost {
|
||||
const metadata = this.metadataCollector.getMetadata(sf);
|
||||
return metadata ? [metadata] : [];
|
||||
}
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
moduleNameToFileName(moduleName: string, containingFile: string): string|null {
|
||||
|
@ -142,7 +142,7 @@ function normalizeLoadedTemplate(
|
||||
styleUrls: o.styleUrls || [],
|
||||
interpolation: o.interpolation || null,
|
||||
encapsulation: o.encapsulation || null,
|
||||
animations: o.animations || null,
|
||||
animations: o.animations || [],
|
||||
},
|
||||
template, templateAbsUrl);
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ export function main() {
|
||||
expect(meta.hostListeners).toEqual({'someHostListener': 'someHostListenerExpr'});
|
||||
expect(meta.hostProperties).toEqual({'someHostProp': 'someHostPropExpr'});
|
||||
expect(meta.hostAttributes).toEqual({'someHostAttr': 'someHostAttrValue'});
|
||||
expect(meta.template.encapsulation).toBe(ViewEncapsulation.Emulated);
|
||||
expect(meta.template.styles).toEqual(['someStyle']);
|
||||
expect(meta.template.template).toEqual('someTemplate');
|
||||
expect(meta.template.interpolation).toEqual(['{{', '}}']);
|
||||
expect(meta.template !.encapsulation).toBe(ViewEncapsulation.Emulated);
|
||||
expect(meta.template !.styles).toEqual(['someStyle']);
|
||||
expect(meta.template !.template).toEqual('someTemplate');
|
||||
expect(meta.template !.interpolation).toEqual(['{{', '}}']);
|
||||
}));
|
||||
|
||||
it('should throw when reading metadata for component with external resources when sync=true is passed',
|
||||
@ -84,9 +84,9 @@ export function main() {
|
||||
resolver.loadNgModuleDirectiveAndPipeMetadata(SomeModule, false).then(() => {
|
||||
const meta = resolver.getDirectiveMetadata(ComponentWithExternalResources);
|
||||
expect(meta.selector).toEqual('someSelector');
|
||||
expect(meta.template.styleUrls).toEqual(['someStyleUrl']);
|
||||
expect(meta.template.templateUrl).toEqual('someTemplateUrl');
|
||||
expect(meta.template.template).toEqual('someTemplate');
|
||||
expect(meta.template !.styleUrls).toEqual(['someStyleUrl']);
|
||||
expect(meta.template !.templateUrl).toEqual('someTemplateUrl');
|
||||
expect(meta.template !.template).toEqual('someTemplate');
|
||||
});
|
||||
resourceLoader.flush();
|
||||
})));
|
||||
@ -104,7 +104,7 @@ export function main() {
|
||||
|
||||
resolver.loadNgModuleDirectiveAndPipeMetadata(SomeModule, false).then(() => {
|
||||
const value: string =
|
||||
resolver.getDirectiveMetadata(ComponentWithoutModuleId).template.templateUrl;
|
||||
resolver.getDirectiveMetadata(ComponentWithoutModuleId).template !.templateUrl !;
|
||||
const expectedEndValue = './someUrl';
|
||||
expect(value.endsWith(expectedEndValue)).toBe(true);
|
||||
});
|
||||
|
Reference in New Issue
Block a user