refactor: Delete isPlainObject type guard and replace its usages with direct typeof checks.
This commit is contained in:
@@ -8,7 +8,7 @@ import React, {
|
||||
import type { SettingsSectionConfig } from '../SettingsModal';
|
||||
import { IconX } from '../../ui/icons';
|
||||
import CapabilityDropdown, { CapabilityDropdownOption } from '../components/CapabilityDropdown';
|
||||
import { isPlainObject } from '../../utils/typeGuards';
|
||||
|
||||
|
||||
type CapabilityValue = string | number;
|
||||
type CapabilitySetId = string | number;
|
||||
@@ -55,15 +55,14 @@ interface CapabilitySetsSectionProps {
|
||||
|
||||
type CapabilityOptionInput = CapabilityDropdownOption | CapabilityValue | null;
|
||||
|
||||
const isCapabilityOption = (option: CapabilityOptionInput): option is CapabilityDropdownOption =>
|
||||
isPlainObject(option);
|
||||
|
||||
|
||||
const resolveCapabilityValue = (option: CapabilityOptionInput): CapabilityValue | null => {
|
||||
if (option == null) {
|
||||
return null;
|
||||
}
|
||||
if (!isCapabilityOption(option)) {
|
||||
return option as CapabilityValue;
|
||||
if (typeof option === 'string' || typeof option === 'number') {
|
||||
return option;
|
||||
}
|
||||
if (option.value != null) {
|
||||
return option.value as CapabilityValue;
|
||||
|
||||
Reference in New Issue
Block a user