Skip to content

Commit dfef55e

Browse files
santoshyadavdevalan-agius4
authored andcommitted
refactor(@angular-devkit/core): remove any types
1 parent aacb98d commit dfef55e

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

packages/angular_devkit/core/node/experimental/jobs/job-registry.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = Jso
5151
return of(null);
5252
}
5353

54-
// TODO: this should be unknown
55-
// tslint:disable-next-line:no-any
56-
function _getValue(...fields: any[]) {
54+
function _getValue(...fields: unknown[]) {
5755
return fields.find(x => schema.isJsonSchema(x)) || true;
5856
}
5957

packages/angular_devkit/core/src/experimental/jobs/api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ export function isJobHandler<
453453
A extends JsonValue,
454454
I extends JsonValue,
455455
O extends JsonValue,
456-
// TODO: this should be unknown
457-
// tslint:disable-next-line:no-any
458-
>(value: any): value is JobHandler<A, I, O> {
459-
return typeof value == 'function'
460-
&& typeof value.jobDescription == 'object'
461-
&& value.jobDescription !== null;
456+
>(value: unknown): value is JobHandler<A, I, O> {
457+
const job = value as JobHandler<A, I, O>;
458+
459+
return typeof job == 'function'
460+
&& typeof job.jobDescription == 'object'
461+
&& job.jobDescription !== null;
462462
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface SchemaValidator {
6969

7070
export interface SchemaFormatter {
7171
readonly async: boolean;
72+
// TODO should be unknown remove before next major release
7273
// tslint:disable-next-line:no-any
7374
validate(data: any): boolean | Observable<boolean>;
7475
}
@@ -84,13 +85,11 @@ export interface SmartDefaultProvider<T> {
8485

8586
export interface SchemaKeywordValidator {
8687
(
87-
// tslint:disable-next-line:no-any
8888
data: JsonValue,
8989
schema: JsonValue,
9090
parent: JsonObject | JsonArray | undefined,
9191
parentProperty: string | number | undefined,
9292
pointer: JsonPointer,
93-
// tslint:disable-next-line:no-any
9493
rootData: JsonValue,
9594
): boolean | Observable<boolean>;
9695
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
447447
}
448448

449449
addFormat(format: SchemaFormat): void {
450-
// tslint:disable-next-line:no-any
451-
const validate = (data: any) => {
450+
const validate = (data: unknown) => {
452451
const result = format.formatter.validate(data);
453452

454453
if (typeof result == 'boolean') {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import { clean } from '../../utils';
9-
import { JsonObject, isJsonObject } from '../interface';
9+
import { JsonObject, JsonValue, isJsonObject } from '../interface';
1010

1111
/**
1212
* A specialized interface for JsonSchema (to come). JsonSchemas are also JsonObject.
@@ -16,10 +16,8 @@ import { JsonObject, isJsonObject } from '../interface';
1616
export type JsonSchema = JsonObject | boolean;
1717

1818

19-
// TODO: this should be unknown
20-
// tslint:disable-next-line:no-any
21-
export function isJsonSchema(value: any): value is JsonSchema {
22-
return isJsonObject(value) || value === false || value === true;
19+
export function isJsonSchema(value: unknown): value is JsonSchema {
20+
return isJsonObject(value as JsonValue) || value === false || value === true;
2321
}
2422

2523
/**

0 commit comments

Comments
 (0)