Typed variables pt1: Use discriminated union for variable model (#52981)

* wip

* make diff easier to read

* Update template_srv getVariables to return new TypedVariableModel

* update VariableType to use the type from TypedVariableModel

* tidy things up
This commit is contained in:
Josh Hunt
2022-08-02 10:15:25 +01:00
committed by GitHub
parent 4d47d7085b
commit eaf6aea98f
12 changed files with 263 additions and 161 deletions
@@ -1,4 +1,4 @@
import { VariableModel, ScopedVars, TimeRange } from '@grafana/data';
import { ScopedVars, TimeRange, TypedVariableModel } from '@grafana/data';
/**
* Via the TemplateSrv consumers get access to all the available template variables
@@ -11,7 +11,7 @@ export interface TemplateSrv {
/**
* List the dashboard variables
*/
getVariables(): VariableModel[];
getVariables(): TypedVariableModel[];
/**
* Replace the values within the target string. See also {@link InterpolateFunction}