mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 01:32:13 +08:00
Chore: improve some types (#95728)
* fix some typings * fix some more * more type fixes * fix some graphite types * few influx fixes
This commit is contained in:
@ -28,7 +28,7 @@ import { preparePlotFrame as defaultPreparePlotFrame } from './utils';
|
||||
/**
|
||||
* @internal -- not a public API
|
||||
*/
|
||||
export type PropDiffFn<T extends any = any> = (prev: T, next: T) => boolean;
|
||||
export type PropDiffFn<T extends Record<string, unknown> = {}> = (prev: T, next: T) => boolean;
|
||||
|
||||
export interface GraphNGProps extends Themeable2 {
|
||||
frames: DataFrame[];
|
||||
@ -61,7 +61,11 @@ export interface GraphNGProps extends Themeable2 {
|
||||
options?: Record<string, any>;
|
||||
}
|
||||
|
||||
function sameProps(prevProps: any, nextProps: any, propsToDiff: Array<string | PropDiffFn> = []) {
|
||||
function sameProps<T extends Record<string, unknown>>(
|
||||
prevProps: T,
|
||||
nextProps: T,
|
||||
propsToDiff: Array<string | PropDiffFn> = []
|
||||
) {
|
||||
for (const propName of propsToDiff) {
|
||||
if (typeof propName === 'function') {
|
||||
if (!propName(prevProps, nextProps)) {
|
||||
|
Reference in New Issue
Block a user