mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Add type for MetricValue
This commit is contained in:
		
							parent
							
								
									73f355984d
								
							
						
					
					
						commit
						4806106fc4
					
				@ -4,15 +4,11 @@ import { createGauge, type Gauge } from './util/metrics';
 | 
			
		||||
 | 
			
		||||
type RestrictedRecord<T extends readonly string[]> = Record<T[number], string>;
 | 
			
		||||
type Query<R> = () => Promise<R | undefined | null>;
 | 
			
		||||
type MapResult<R> = (result: R) =>
 | 
			
		||||
    | {
 | 
			
		||||
          count: number;
 | 
			
		||||
          labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>;
 | 
			
		||||
      }
 | 
			
		||||
    | {
 | 
			
		||||
          count: number;
 | 
			
		||||
          labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>;
 | 
			
		||||
      }[];
 | 
			
		||||
type MetricValue<R> = {
 | 
			
		||||
    count: number;
 | 
			
		||||
    labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>;
 | 
			
		||||
};
 | 
			
		||||
type MapResult<R> = (result: R) => MetricValue<R> | MetricValue<R>[];
 | 
			
		||||
 | 
			
		||||
type GaugeDefinition<T> = {
 | 
			
		||||
    name: string;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user