mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
2988a6c6dc
* Fix type linting and indent errors * Properly indent comments too
22 lines
818 B
TypeScript
22 lines
818 B
TypeScript
/* eslint-disable @typescript-eslint/ban-types */
|
|
|
|
// DeepPartial implementation taken from the utility-types NPM package, which is
|
|
// Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)
|
|
// and used under the terms of the MIT license
|
|
export type DeepPartial<T> = T extends Function
|
|
? T
|
|
: T extends Array<infer U>
|
|
? _DeepPartialArray<U>
|
|
: T extends object
|
|
? _DeepPartialObject<T>
|
|
: T | undefined;
|
|
|
|
type _DeepPartialArray<T> = Array<DeepPartial<T>>
|
|
type _DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };
|
|
|
|
export type DistributiveArray<T> = [T] extends [unknown] ? Array<T> : never
|
|
|
|
// https://stackoverflow.com/a/50375286
|
|
export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
|