Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Functions

Type aliases

AddModel

AddModel<Model>: object

Type of the data passed to the set function. It extends the model allowing to set server date field value.

Type parameters

  • Model

Type declaration

Functions

add

  • Adds a new document with a random id to a collection.

    import { add, collection } from 'typesaurus'
    
    type User = { name: string }
    const users = collection<User>('users')
    
    const user = await add(users, { name: 'Sasha' })
    console.log(user.id)
    //=> '00sHm46UWKObv2W7XK9e'

    Type parameters

    • Model

    Parameters

    • collection: Collection<Model>

      The collection to add to

    • data: AddModel<Model>

      The data to add to

    Returns Promise<Ref<Model>>

    A promise to the ref

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc