Change all typeof x === 'undefined' to
x === undefined`
https://github.com/theatre-js/theatre/pull/118#discussion_r846634374
This commit is contained in:
parent
f3dfb7cedb
commit
b2714ca876
6 changed files with 9 additions and 9 deletions
|
@ -164,7 +164,7 @@ export default class SheetObject implements IdentityDerivationProvider {
|
|||
const leftDeserialized = deserializeAndSanitize(triple.left)
|
||||
|
||||
const left =
|
||||
typeof leftDeserialized === 'undefined'
|
||||
leftDeserialized === undefined
|
||||
? propConfig.default
|
||||
: leftDeserialized
|
||||
|
||||
|
@ -173,7 +173,7 @@ export default class SheetObject implements IdentityDerivationProvider {
|
|||
|
||||
const rightDeserialized = deserializeAndSanitize(triple.right)
|
||||
const right =
|
||||
typeof rightDeserialized === 'undefined'
|
||||
rightDeserialized === undefined
|
||||
? propConfig.default
|
||||
: rightDeserialized
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export function getPropConfigByPath(
|
|||
): undefined | PropTypeConfig {
|
||||
if (!parentConf) return undefined
|
||||
const [key, ...rest] = path
|
||||
if (typeof key === 'undefined') return parentConf
|
||||
if (key === undefined) return parentConf
|
||||
if (!isPropConfigComposite(parentConf)) return undefined
|
||||
|
||||
const sub =
|
||||
|
@ -44,7 +44,7 @@ export function valueInProp<PropConfig extends PropTypeConfig_AllNonCompounds>(
|
|||
? T
|
||||
: never {
|
||||
const sanitizedVal = propConfig.deserializeAndSanitize(value)
|
||||
if (typeof sanitizedVal === 'undefined') {
|
||||
if (sanitizedVal === undefined) {
|
||||
return propConfig.default
|
||||
} else {
|
||||
return sanitizedVal
|
||||
|
|
|
@ -24,7 +24,7 @@ export default function deepMergeWithCache<T extends SerializableMap>(
|
|||
merged[key] =
|
||||
typeof valueInOverride === 'object' && typeof valueInBase === 'object'
|
||||
? deepMergeWithCache(valueInBase, valueInOverride, cache)
|
||||
: typeof valueInOverride === 'undefined'
|
||||
: valueInOverride === undefined
|
||||
? valueInBase
|
||||
: valueInOverride
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function forEachDeep<
|
|||
for (const [key, value] of Object.entries(m)) {
|
||||
forEachDeep(value!, fn, [...startingPath, key])
|
||||
}
|
||||
} else if (typeof m === 'undefined' || m === null) {
|
||||
} else if (m === undefined || m === null) {
|
||||
return
|
||||
} else {
|
||||
fn(m as $IntentionalAny as Primitive, startingPath)
|
||||
|
|
|
@ -100,14 +100,14 @@ export default function createTransactionPrivateApi(
|
|||
propConfig: PropTypeConfig_AllNonCompounds,
|
||||
path: PathToProp,
|
||||
) => {
|
||||
if (typeof value === 'undefined' || value === null) {
|
||||
if (value === undefined || value === null) {
|
||||
return
|
||||
}
|
||||
|
||||
const deserialized = cloneDeepSerializable(
|
||||
propConfig.deserializeAndSanitize(value),
|
||||
)
|
||||
if (typeof deserialized === 'undefined') {
|
||||
if (deserialized === undefined) {
|
||||
throw new Error(
|
||||
`Invalid value ${userReadableTypeOfValue(
|
||||
value,
|
||||
|
|
|
@ -58,7 +58,7 @@ export const setDrafts__onlyMeantToBeCalledByTransaction = (
|
|||
let currentDrafts: undefined | Drafts
|
||||
|
||||
const drafts = (): Drafts => {
|
||||
if (typeof currentDrafts === 'undefined') {
|
||||
if (currentDrafts === undefined) {
|
||||
throw new Error(
|
||||
`Calling stateEditors outside of a transaction is not allowed.`,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue