Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Functions

Type aliases

Subcollection

Subcollection<RefModel, CollectionModel>: function

The subcollection function type.

Type parameters

  • RefModel

  • CollectionModel

Type declaration

    • Parameters

      • ref: Ref<RefModel> | string

      Returns Collection<CollectionModel>

Functions

subcollection

  • subcollection<CollectionModel, RefModel>(name: string, parentCollection: Collection<RefModel>): Subcollection<RefModel, CollectionModel>
  • Creates a subcollection function which accepts parent document reference and returns the subcollection trasnformed into a collection object.

    import { subcollection, collection, ref, add } from 'typesaurus'
    
    type User = { name: string }
    type Order = { item: string }
    const users = collection<User>('users')
    const userOrders = subcollection<Order, User>('orders')
    
    const sashasOrders = userOrders('00sHm46UWKObv2W7XK9e')
    //=> { __type__: 'collection', path: 'users/00sHm46UWKObv2W7XK9e/orders' }
    // Also accepts reference:
    userOrders(ref(users, '00sHm46UWKObv2W7XK9e')))
    
    add(sashasOrders, { item: 'Snowboard boots' })

    Type parameters

    • CollectionModel

    • RefModel

    Parameters

    • name: string

      The subcollection name

    • parentCollection: Collection<RefModel>

      The parent collection

    Returns Subcollection<RefModel, CollectionModel>

    Function which accepts parent document

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