mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-16 20:30:36 +03:00
fix types
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
OptionsTemplateNativeTypes,
|
OptionsTemplateNativeTypes,
|
||||||
OptionsTemplateTypes,
|
OptionsTemplateTypes,
|
||||||
OptionsTemplateValue,
|
OptionsTemplateValue,
|
||||||
} from 'plugins/optionsValidation/validation';
|
} from 'plugins/optionsValidationPlugin/validation';
|
||||||
import { PlainObject } from 'typings';
|
import { PlainObject } from 'typings';
|
||||||
import { isArray } from 'support/utils/types';
|
import { isArray } from 'support/utils/types';
|
||||||
import { each, keys } from 'support/utils';
|
import { each, keys } from 'support/utils';
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ type Attr = {
|
|||||||
| void;
|
| void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GetSetProp = {
|
type GetSetProp<T> = {
|
||||||
(elm: HTMLElement | false | null | undefined): number;
|
(elm: HTMLElement | false | null | undefined): T;
|
||||||
(elm: HTMLElement | false | null | undefined, value: number): void;
|
(elm: HTMLElement | false | null | undefined, value: T): void;
|
||||||
(elm: HTMLElement | false | null | undefined, value?: number): number | void;
|
(elm: HTMLElement | false | null | undefined, value?: T): number | void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSetProp = (
|
const getSetProp = (
|
||||||
@@ -102,7 +102,7 @@ export const removeAttr = (elm: Element | false | null | undefined, attrName: st
|
|||||||
export const scrollLeft = ((
|
export const scrollLeft = ((
|
||||||
elm: HTMLElement | false | null | undefined,
|
elm: HTMLElement | false | null | undefined,
|
||||||
value?: number
|
value?: number
|
||||||
): number | void => getSetProp('scrollLeft', 0, elm, value) as number) as GetSetProp;
|
): number | void => getSetProp('scrollLeft', 0, elm, value) as number) as GetSetProp<number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the scrollTop value of the given element depending whether the value attribute is given.
|
* Gets or sets the scrollTop value of the given element depending whether the value attribute is given.
|
||||||
@@ -112,7 +112,7 @@ export const scrollLeft = ((
|
|||||||
export const scrollTop = ((
|
export const scrollTop = ((
|
||||||
elm: HTMLElement | false | null | undefined,
|
elm: HTMLElement | false | null | undefined,
|
||||||
value?: number
|
value?: number
|
||||||
): number | void => getSetProp('scrollTop', 0, elm, value) as number) as GetSetProp;
|
): number | void => getSetProp('scrollTop', 0, elm, value) as number) as GetSetProp<number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the value of the given input element depending whether the value attribute is given.
|
* Gets or sets the value of the given input element depending whether the value attribute is given.
|
||||||
@@ -122,4 +122,4 @@ export const scrollTop = ((
|
|||||||
export const val = ((
|
export const val = ((
|
||||||
elm: HTMLInputElement | false | null | undefined,
|
elm: HTMLInputElement | false | null | undefined,
|
||||||
value?: string
|
value?: string
|
||||||
): string | void => getSetProp('value', '', elm, value) as string) as GetSetProp;
|
): string | void => getSetProp('value', '', elm, value) as string) as GetSetProp<string>;
|
||||||
|
|||||||
Reference in New Issue
Block a user