SettingsBase: Allow null as defaultValue
Maintenance
Affected app variants: all
Summary
The SettingsBase<T>
interface (and by extension SettingsEntry<T>
) should allow null
as the defaultValue
in addition to T
.
SettingsBase<T>
and SettingsEntry<T>
should have unknown
as the default for the type variable.
Background
This helps resolve the following eslint error: "Object literal's property 'defaultValue' implicitly has an 'any' type."
const settingsEntry = {
// ...
defaultValue: null, // error :(
}
const settingsEntry: SettingsEntry<unknown> = {
// ...
defaultValue: null, // no error :)
}
Acceptance Criteria
-
SettingsBase<T>
interface allowsnull
as thedefaultValue
in addition toT
. -
SettingsBase<T>
andSettingsEntry<T>
specifyunknown
as the default for the type variable. -
The linting error is resolved.