fix(compiler): update type castings for JSON.parse usage (#40710)

Update usages of JSON.parse to be cast as specific types.

PR Close #40710
This commit is contained in:
Joey Perrott
2021-02-04 14:38:25 -08:00
committed by Alex Rickabaugh
parent b75d7cb11f
commit f728490222
5 changed files with 14 additions and 13 deletions
@@ -461,7 +461,7 @@ class FromJsonDeserializer extends ValueTransformer {
summaries: Summary<StaticSymbol>[],
importAs: {symbol: StaticSymbol, importAs: StaticSymbol}[]
} {
const data: {moduleName: string|null, summaries: any[], symbols: any[]} = JSON.parse(json);
const data = JSON.parse(json) as {moduleName: string | null, summaries: any[], symbols: any[]};
const allImportAs: {symbol: StaticSymbol, importAs: StaticSymbol}[] = [];
this.symbols = data.symbols.map(
(serializedSymbol) => this.symbolCache.get(
+1 -1
View File
@@ -427,7 +427,7 @@ export class MockAotCompilerHost implements AotCompilerHost {
if (this.metadataVisible) {
const metadataPath = modulePath.replace(DTS, '.metadata.json');
if (this.tsHost.fileExists(metadataPath)) {
let result = JSON.parse(this.tsHost.readFile(metadataPath));
let result = JSON.parse(this.tsHost.readFile(metadataPath)) as {[key: string]: any}[];
return Array.isArray(result) ? result : [result];
}
}