build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a `!` assertion. Issue/24571 is tracking proper clean up of those instances. One-line change required in ivy/compilation.ts, because it appears that the new syntax causes tsickle emitted node to no longer track their original sourceFiles. PR Close #24572
This commit is contained in:
@ -185,7 +185,8 @@ export function getExpressionScope(
|
||||
|
||||
class ExpressionDiagnosticsVisitor extends RecursiveTemplateAstVisitor {
|
||||
private path: TemplateAstPath;
|
||||
private directiveSummary: CompileDirectiveSummary;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private directiveSummary !: CompileDirectiveSummary;
|
||||
|
||||
diagnostics: ExpressionDiagnostic[] = [];
|
||||
|
||||
|
@ -23,7 +23,8 @@ export class TypeDiagnostic {
|
||||
|
||||
// AstType calculatetype of the ast given AST element.
|
||||
export class AstType implements AstVisitor {
|
||||
public diagnostics: TypeDiagnostic[];
|
||||
// TODO(issue/24571): remove '!'.
|
||||
public diagnostics !: TypeDiagnostic[];
|
||||
|
||||
constructor(
|
||||
private scope: SymbolTable, private query: SymbolQuery,
|
||||
@ -334,7 +335,8 @@ export class AstType implements AstVisitor {
|
||||
return this.resolvePropertyRead(this.query.getNonNullableType(this.getType(ast.receiver)), ast);
|
||||
}
|
||||
|
||||
private _anyType: Symbol;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _anyType !: Symbol;
|
||||
private get anyType(): Symbol {
|
||||
let result = this._anyType;
|
||||
if (!result) {
|
||||
@ -343,7 +345,8 @@ export class AstType implements AstVisitor {
|
||||
return result;
|
||||
}
|
||||
|
||||
private _undefinedType: Symbol;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _undefinedType !: Symbol;
|
||||
private get undefinedType(): Symbol {
|
||||
let result = this._undefinedType;
|
||||
if (!result) {
|
||||
|
@ -84,7 +84,8 @@ export function getPipesTable(
|
||||
|
||||
class TypeScriptSymbolQuery implements SymbolQuery {
|
||||
private typeCache = new Map<BuiltinType, Symbol>();
|
||||
private pipesCache: SymbolTable;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private pipesCache !: SymbolTable;
|
||||
|
||||
constructor(
|
||||
private program: ts.Program, private checker: ts.TypeChecker, private source: ts.SourceFile,
|
||||
@ -283,8 +284,10 @@ class TypeWrapper implements Symbol {
|
||||
|
||||
class SymbolWrapper implements Symbol {
|
||||
private symbol: ts.Symbol;
|
||||
private _tsType: ts.Type;
|
||||
private _members: SymbolTable;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _tsType !: ts.Type;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _members !: SymbolTable;
|
||||
|
||||
public readonly nullable: boolean = false;
|
||||
public readonly language: string = 'typescript';
|
||||
@ -529,7 +532,8 @@ class PipesTable implements SymbolTable {
|
||||
const INDEX_PATTERN = /[\\/]([^\\/]+)[\\/]\1\.d\.ts$/;
|
||||
|
||||
class PipeSymbol implements Symbol {
|
||||
private _tsType: ts.Type;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _tsType !: ts.Type;
|
||||
public readonly kind: DeclarationKind = 'pipe';
|
||||
public readonly language: string = 'typescript';
|
||||
public readonly container: Symbol|undefined = undefined;
|
||||
|
@ -85,7 +85,8 @@ export class MetadataBundler {
|
||||
private exports = new Map<string, Symbol[]>();
|
||||
private rootModule: string;
|
||||
private privateSymbolPrefix: string;
|
||||
private exported: Set<Symbol>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private exported !: Set<Symbol>;
|
||||
|
||||
constructor(
|
||||
private root: string, private importAs: string|undefined, private host: MetadataBundlerHost,
|
||||
|
@ -11,7 +11,8 @@ import * as ts from 'typescript';
|
||||
import {MetadataSymbolicReferenceExpression, MetadataValue} from './schema';
|
||||
|
||||
export class Symbols {
|
||||
private _symbols: Map<string, MetadataValue>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _symbols !: Map<string, MetadataValue>;
|
||||
private references = new Map<string, MetadataSymbolicReferenceExpression>();
|
||||
|
||||
constructor(private sourceFile: ts.SourceFile) {}
|
||||
|
@ -88,7 +88,8 @@ export abstract class Reference {
|
||||
/**
|
||||
* Whether an `Expression` can be generated which references the node.
|
||||
*/
|
||||
readonly expressable: boolean;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
readonly expressable !: boolean;
|
||||
|
||||
/**
|
||||
* Generate an `Expression` representing this type, in the context of the given SourceFile.
|
||||
|
@ -120,7 +120,7 @@ export class IvyCompilation {
|
||||
|
||||
// Look up the .d.ts transformer for the input file and record that a field was generated,
|
||||
// which will allow the .d.ts to be transformed later.
|
||||
const fileName = node.getSourceFile().fileName;
|
||||
const fileName = original.getSourceFile().fileName;
|
||||
const dtsTransformer = this.getDtsTransformer(fileName);
|
||||
dtsTransformer.recordStaticField(reflectNameOfDeclaration(node) !, res);
|
||||
|
||||
|
@ -74,10 +74,14 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
||||
private emitter = new TypeScriptEmitter();
|
||||
private metadataReaderHost: MetadataReaderHost;
|
||||
|
||||
getCancellationToken: () => ts.CancellationToken;
|
||||
getDefaultLibLocation: () => string;
|
||||
trace: (s: string) => void;
|
||||
getDirectories: (path: string) => string[];
|
||||
// TODO(issue/24571): remove '!'.
|
||||
getCancellationToken !: () => ts.CancellationToken;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
getDefaultLibLocation !: () => string;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
trace !: (s: string) => void;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
getDirectories !: (path: string) => string[];
|
||||
directoryExists?: (directoryName: string) => boolean;
|
||||
|
||||
constructor(
|
||||
|
@ -252,7 +252,8 @@ function isLiteralFieldNamed(node: ts.Node, names: Set<string>): boolean {
|
||||
}
|
||||
|
||||
export class LowerMetadataTransform implements RequestsMap, MetadataTransformer {
|
||||
private cache: MetadataCache;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private cache !: MetadataCache;
|
||||
private requests = new Map<string, RequestLocationMap>();
|
||||
private lowerableFieldNames: Set<string>;
|
||||
|
||||
|
@ -115,7 +115,8 @@ class AngularCompilerProgram implements Program {
|
||||
private rootNames: string[];
|
||||
private metadataCache: MetadataCache;
|
||||
// Metadata cache used exclusively for the flat module index
|
||||
private flatModuleMetadataCache: MetadataCache;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private flatModuleMetadataCache !: MetadataCache;
|
||||
private loweringMetadataTransform: LowerMetadataTransform;
|
||||
private oldProgramLibrarySummaries: Map<string, LibrarySummary>|undefined;
|
||||
private oldProgramEmittedGeneratedFiles: Map<string, GeneratedFile>|undefined;
|
||||
@ -127,15 +128,19 @@ class AngularCompilerProgram implements Program {
|
||||
private emittedSourceFiles: ts.SourceFile[]|undefined;
|
||||
|
||||
// Lazily initialized fields
|
||||
private _compiler: AotCompiler;
|
||||
private _hostAdapter: TsCompilerAotCompilerTypeCheckHostAdapter;
|
||||
private _tsProgram: ts.Program;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _compiler !: AotCompiler;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _hostAdapter !: TsCompilerAotCompilerTypeCheckHostAdapter;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _tsProgram !: ts.Program;
|
||||
private _analyzedModules: NgAnalyzedModules|undefined;
|
||||
private _analyzedInjectables: NgAnalyzedFileWithInjectables[]|undefined;
|
||||
private _structuralDiagnostics: Diagnostic[]|undefined;
|
||||
private _programWithStubs: ts.Program|undefined;
|
||||
private _optionsDiagnostics: Diagnostic[] = [];
|
||||
private _reifiedDecorators: Set<StaticSymbol>;
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private _reifiedDecorators !: Set<StaticSymbol>;
|
||||
|
||||
constructor(
|
||||
rootNames: ReadonlyArray<string>, private options: CompilerOptions,
|
||||
|
Reference in New Issue
Block a user