getSetting Method

Get the highest priority setting for a SettingName.

getSetting<T extends JSONSchemaType>(settingName: string, defaultValue?: T): undefined | T

@note This method is generic on SettingType, but no type checking is actually performed at run time. So, if you use this method to get a setting with an expected type, but its value is a different type, the return type of this method will be wrong. You must always type check the result. Use the non-generic "get" methods (e.g. Settings.getString) if you only want the value if its type is correct.

Parameter Type Description
settingName string The name of the setting
defaultValue T value returned if settingName is not present in any SettingDictionary.

Returns - undefined | T

Defined in

Last Updated: 16 April, 2024