Skip to content

Commit

Permalink
refactor(@angular-devkit/core): additional JSON parse type casting
Browse files Browse the repository at this point in the history
Add type casting to several additional `JSON.parse` usages to avoid
implicit any usage in the code.
  • Loading branch information
clydin authored and alan-agius4 committed Jun 25, 2024
1 parent 099e08c commit 7c5b365
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/angular_devkit/core/src/json/schema/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
});
res.on('end', () => {
try {
const json = JSON.parse(data);
const json = JSON.parse(data) as JsonObject;
this._uriCache.set(uri, json);
resolve(json);
} catch (err) {
Expand Down Expand Up @@ -630,7 +630,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
smartDefaults: Map<string, JsonObject>,
): Promise<void> {
for (const [pointer, schema] of smartDefaults.entries()) {
const fragments = JSON.parse(pointer);
const fragments = JSON.parse(pointer) as string[];
const source = this._sourceMap.get(schema.$source as string);
if (!source) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/core/src/utils/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function deepCopy<T>(value: T): T {
}

if (valueCasted['toJSON']) {
return JSON.parse(valueCasted['toJSON']());
return JSON.parse(valueCasted['toJSON']()) as T;
}

const copy = Object.create(Object.getPrototypeOf(valueCasted));
Expand Down

0 comments on commit 7c5b365

Please sign in to comment.