Skip to content

JsonKit.Types

github-actions[bot] edited this page Jul 30, 2023 · 1 revision

Namespace: Types

JsonKit.Types

Table of contents

Type Aliases

Type Aliases

TypeGuardFunction

Ƭ TypeGuardFunction<T>: (obj: any) => obj is T

Type parameters

Name Description
T The type to check against

Type declaration

▸ (obj): obj is T

A function that checks the input object against a specific type.

Example

type Foo {
  bar: number
}

function isFoo(obj: any): obj is Foo {
  const _obj: Partial<Foo> | null | undefined = obj
  return typeof _obj?.bar === "number"
}
Parameters
Name Type
obj any
Returns

obj is T

Defined in

types.ts:18