mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Alex Rickabaugh
parent
b75d7cb11f
commit
f728490222
@@ -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(
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user