Type

Common types

Shared aliases exported from ngwr/utilsMaybe<T> for optional values and SafeAny for explicit interop escapes.

Import

import type { Maybe, SafeAny } from 'ngwr/utils';

Usage

function findUser(id: string): Maybe<User> {
  return db.get(id) ?? null;
}

// Interop boundary where the shape genuinely isn't known —
// unlike `any`, the intent is explicit and greppable.
function fromLegacyBridge(payload: SafeAny): void {
  // narrow before use
}

API

NameDescriptionTypeDefault
Maybe<T>A value that may be absent — T | null | undefined. Pairs with isDefined to narrow back to T.type alias
SafeAnyExplicitly untyped value for interop boundaries. Same mechanics as any, but the name is searchable and signals intent.type alias