mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 02:24:10 +08:00
refactor(@angular-devkit/core): remove any types
This commit is contained in:
parent
aacb98d85b
commit
dfef55e3f7
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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>;
|
||||
}
|
||||
|
@ -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') {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user