refactor(@angular-devkit/core): remove any types

This commit is contained in:
santoshyadavdev 2020-08-16 11:02:48 +05:30 committed by Alan Agius
parent aacb98d85b
commit dfef55e3f7
5 changed files with 12 additions and 18 deletions

View File

@ -51,9 +51,7 @@ export class NodeModuleJobRegistry<MinimumArgumentValueT extends JsonValue = Jso
return of(null);
}
// TODO: this should be unknown
// tslint:disable-next-line:no-any
function _getValue(...fields: any[]) {
function _getValue(...fields: unknown[]) {
return fields.find(x => schema.isJsonSchema(x)) || true;
}

View File

@ -453,10 +453,10 @@ export function isJobHandler<
A extends JsonValue,
I extends JsonValue,
O extends JsonValue,
// TODO: this should be unknown
// tslint:disable-next-line:no-any
>(value: any): value is JobHandler<A, I, O> {
return typeof value == 'function'
&& typeof value.jobDescription == 'object'
&& value.jobDescription !== null;
>(value: unknown): value is JobHandler<A, I, O> {
const job = value as JobHandler<A, I, O>;
return typeof job == 'function'
&& typeof job.jobDescription == 'object'
&& job.jobDescription !== null;
}

View File

@ -69,6 +69,7 @@ export interface SchemaValidator {
export interface SchemaFormatter {
readonly async: boolean;
// TODO should be unknown remove before next major release
// tslint:disable-next-line:no-any
validate(data: any): boolean | Observable<boolean>;
}
@ -84,13 +85,11 @@ export interface SmartDefaultProvider<T> {
export interface SchemaKeywordValidator {
(
// tslint:disable-next-line:no-any
data: JsonValue,
schema: JsonValue,
parent: JsonObject | JsonArray | undefined,
parentProperty: string | number | undefined,
pointer: JsonPointer,
// tslint:disable-next-line:no-any
rootData: JsonValue,
): boolean | Observable<boolean>;
}

View File

@ -447,8 +447,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
}
addFormat(format: SchemaFormat): void {
// tslint:disable-next-line:no-any
const validate = (data: any) => {
const validate = (data: unknown) => {
const result = format.formatter.validate(data);
if (typeof result == 'boolean') {

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import { clean } from '../../utils';
import { JsonObject, isJsonObject } from '../interface';
import { JsonObject, JsonValue, isJsonObject } from '../interface';
/**
* A specialized interface for JsonSchema (to come). JsonSchemas are also JsonObject.
@ -16,10 +16,8 @@ import { JsonObject, isJsonObject } from '../interface';
export type JsonSchema = JsonObject | boolean;
// TODO: this should be unknown
// tslint:disable-next-line:no-any
export function isJsonSchema(value: any): value is JsonSchema {
return isJsonObject(value) || value === false || value === true;
export function isJsonSchema(value: unknown): value is JsonSchema {
return isJsonObject(value as JsonValue) || value === false || value === true;
}
/**