Copyright (C) 2018-present, Rimeto, LLC.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

## Index

### Interfaces

- ArrayWrapper
- IDataAccessor

### Type aliases

- DataWrapper
- Defined
- OCType
- ObjectWrapper

### Functions

- oc

## Type aliases

### DataWrapper

DataWrapper: DataWrapper<T>

- Defined in node_modules/ts-optchain/dist/index.d.ts:48

`DataWrapper` selects between `ArrayWrapper`, `ObjectWrapper`, and `IDataAccessor` to wrap Arrays, Objects and all other types respectively.

### Defined

Defined: Exclude<T, undefined>

- Defined in node_modules/ts-optchain/dist/index.d.ts:10

A generic type that cannot be `undefined`.

### OCType

OCType: IDataAccessor<T> & DataWrapper<NonNullable<T>>

- Defined in node_modules/ts-optchain/dist/index.d.ts:52

An object that supports optional chaining

### ObjectWrapper

ObjectWrapper: object

- Defined in node_modules/ts-optchain/dist/index.d.ts:32

`ObjectWrapper` gives TypeScript visibility into the properties of an `OCType` object at compile-time.

#### Type declaration

## Functions

### oc

- oc<T>(data?: T): OCType<T>

- - Defined in node_modules/ts-optchain/dist/index.d.ts:77

  Proxies access to the passed object to support optional chaining w/ default values. To look at a property deep in a tree-like structure, invoke it as a function passing an optional default value.

  example

    // Given: const x = oc({ a: 'hello', b: { d: 'world' }, c: [-100, 200, -300], });

    // Then: x.a() === 'hello' x.b.d() === 'world' x.c0 === -100 x.c100 === undefined x.c100 === 1234 x.c.map((e) => e()) === [-100, 200, -300] x.d.e() === undefined x.d.e('optional default value') === 'optional default value' (x as any).y.z.a.b.c.d.e.f.g.h.i.j.k() === undefined

  #### Type parameters

  - #### T

  #### Parameters

  - ##### Optional data: T

  #### Returns OCType<T>

Generated using TypeDoc