This works fine for now, but if you were to try to use this hook to use any other UI setting the type check would fail.
The kibanaReact plugin exports a useUiSetting already, so we could use that instead. You can give it a type parameter but it does not check the type of the key parameter against a known list of UI settings.
Lists of all the advanced settings keys are in the usageCollection plugin for the purpose of telemetry:
So you could add the typing to the kibanaReact hook, but usageCollection is not currently a dependency of kibanaReact, so it might just be best to leave it.
In https://github.com/elastic/kibana/blob/master/x-pack/plugins/observability/public/hooks/use_kibana_ui_settings.tsx, the
UI_SETTINGS
imported there that specifies the types allowed for using a kibana UI setting are only those from the data plugin.This works fine for now, but if you were to try to use this hook to use any other UI setting the type check would fail.
The kibanaReact plugin exports a
useUiSetting
already, so we could use that instead. You can give it a type parameter but it does not check the type of the key parameter against a known list of UI settings.Lists of all the advanced settings keys are in the usageCollection plugin for the purpose of telemetry:
So you could add the typing to the kibanaReact hook, but usageCollection is not currently a dependency of kibanaReact, so it might just be best to leave it.