Skip to content

Commit

Permalink
SLEIGHT-20: get rid of 'any'
Browse files Browse the repository at this point in the history
  • Loading branch information
synkarius committed Sep 20, 2022
1 parent 29dd3b2 commit c835591
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/common/common-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const isIdSelected = (id?: string): boolean =>
export const isEnumSelected = (id?: string): boolean =>
!!id && id !== UNSELECTED_ENUM;

export const isTruthy = (t: any) => !!t;
export const isTruthy = (t: unknown) => !!t;

export const replaceNonAlphaNumeric = (
value: string,
Expand Down
2 changes: 1 addition & 1 deletion src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Object.defineProperty(global, 'crypto', {

// missing from test env; may be fixed in Jest 28.x
Object.defineProperty(global, 'structuredClone', {
value: (original: any) => JSON.parse(JSON.stringify(original)),
value: (original: unknown) => JSON.parse(JSON.stringify(original)),
});
2 changes: 1 addition & 1 deletion src/test/utils/import-test-json-util.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/** Test utility function: casts imported json. */
export const castJsonForTest = <T>(jsonObject: any): T => jsonObject as T;
export const castJsonForTest = <T>(jsonObject: unknown): T => jsonObject as T;
2 changes: 1 addition & 1 deletion src/ui/model/command/command-editing-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type AbstractCommandReducerAction<T> = {
};

export interface CommandReducerNoPayloadAction
extends Omit<AbstractCommandReducerAction<any>, 'payload'> {
extends Omit<AbstractCommandReducerAction<unknown>, 'payload'> {
type: typeof CommandReducerActionType.ADD_ACTION;
}

Expand Down
8 changes: 4 additions & 4 deletions src/validation/ValidationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type ValidationPropsComponent = <E>(
props: ValidationProps<E>
) => React.ReactElement<ValidationProps<E>>;

const isTouched = (
validator: FieldValidator<any>,
const isTouched = <E,>(
validator: FieldValidator<E>,
touched: Field[]
): boolean => {
const validatorType = validator.validatorType;
Expand All @@ -49,9 +49,9 @@ const isTouched = (
* - mode: submit -> any except delete
* - mode: delete -> delete validators only
*/
const shouldUseValidator = (
const shouldUseValidator = <E,>(
mode: ValidateMode,
validator: FieldValidator<any>,
validator: FieldValidator<E>,
touched: Field[]
): boolean => {
const isDeletionValidator =
Expand Down

0 comments on commit c835591

Please sign in to comment.