Skip to content

Commit 7c5b365

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular-devkit/core): additional JSON parse type casting
Add type casting to several additional `JSON.parse` usages to avoid implicit any usage in the code.
1 parent 099e08c commit 7c5b365

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/angular_devkit/core/src/json/schema/registry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
156156
});
157157
res.on('end', () => {
158158
try {
159-
const json = JSON.parse(data);
159+
const json = JSON.parse(data) as JsonObject;
160160
this._uriCache.set(uri, json);
161161
resolve(json);
162162
} catch (err) {
@@ -630,7 +630,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
630630
smartDefaults: Map<string, JsonObject>,
631631
): Promise<void> {
632632
for (const [pointer, schema] of smartDefaults.entries()) {
633-
const fragments = JSON.parse(pointer);
633+
const fragments = JSON.parse(pointer) as string[];
634634
const source = this._sourceMap.get(schema.$source as string);
635635
if (!source) {
636636
continue;

packages/angular_devkit/core/src/utils/object.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function deepCopy<T>(value: T): T {
2525
}
2626

2727
if (valueCasted['toJSON']) {
28-
return JSON.parse(valueCasted['toJSON']());
28+
return JSON.parse(valueCasted['toJSON']()) as T;
2929
}
3030

3131
const copy = Object.create(Object.getPrototypeOf(valueCasted));

0 commit comments

Comments
 (0)