Skip to content

Commit

Permalink
Adjust uischema type guards to be compatible with 'strictNullChecks'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdirix committed Sep 21, 2022
1 parent 9378457 commit 1844262
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/models/uischema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ export const isLayout = (uischema: UISchemaElement): uischema is Layout =>
(uischema as Layout).elements !== undefined;

export const isScopable = (obj: unknown): obj is Scopable =>
obj && typeof obj === 'object';
!!obj && typeof obj === 'object';

export const isScoped = (obj: unknown): obj is Scoped =>
isScopable(obj) && typeof obj.scope === 'string';

export const isLabelable = (obj: unknown): obj is Labelable =>
obj && typeof obj === 'object';
!!obj && typeof obj === 'object';

export const isLabeled = <T = never>(obj: unknown): obj is Labeled<T> =>
isLabelable(obj) && ['string', 'boolean'].includes(typeof obj.label);

0 comments on commit 1844262

Please sign in to comment.