import type {Animation} from '../../types/animation';
import {isNumber} from '../helpers/helpers.math';
-export default class Element<T extends AnyObject = AnyObject, O extends AnyObject = AnyObject> {
+export default class Element<T = AnyObject, O = AnyObject> {
static defaults = {};
static defaultRoutes = undefined;
* @param props - properties to get
* @param [final] - get the final value (animation target)
*/
- getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]> {
+ getProps<P extends string>(props: P[], final?: boolean): Partial<Record<P, unknown>>;
+ getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
+ getProps(props: string[], final?: boolean): Partial<Record<string, unknown>> {
const anims = this.$animations;
if (!final || !anims) {
// let's not create an object, if not needed
- return this as Pick<T, P[number]>;
+ return this as Record<string, unknown>;
}
- const ret: Partial<Pick<T, P[number]>> = {};
+ const ret: Record<string, unknown> = {};
props.forEach((prop) => {
ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : this[prop as string];
});
- return ret as Pick<T, P[number]>;
+ return ret;
}
}
this._parseOpts = undefined;
}
- init(scaleOpts, opts) {
+ init(scaleOpts, opts = {}) {
const time = scaleOpts.time || (scaleOpts.time = {});
/** @type {DateAdapter} */
const adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);
* They add extra margins on the both sides by scaling down the original scale.
* Offsets are added when the `offset` option is true.
* @param {number[]} timestamps
- * @return {object}
* @protected
*/
- initOffsets(timestamps) {
+ initOffsets(timestamps = []) {
let start = 0;
let end = 0;
let first, last;
"allowSyntheticDefaultImports": true,
/* Language and Environment */
"target": "ES6",
- "lib": ["es2018", "DOM"],
- /* Completeness */
- "skipLibCheck": true
+ "lib": ["es2018", "DOM"]
},
"typedocOptions": {
"name": "Chart.js",
export * from './helpers.color';
export * from './helpers.curve';
export * from './helpers.dom';
-export * from './helpers.easing';
export * from './helpers.extras';
export * from './helpers.interpolation';
export * from './helpers.intl';