Skip to content

Typescript utility for firebase. Provides intellisense and type safety for realtime db and firestore methods and documents.

Notifications You must be signed in to change notification settings

th-m/firebase-typed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

firebase-typed

Typescript utility for firebase. Provides intellisense and type safety for realtime db and firestore methods and documents.

Usage

All you need to create a typed instance of your db is an defined interface.

### Import

import { typedRealTimeDB, TypedRealTimeDB } from 'firebase-typed';

export interface Game {
    host: Player,
    characters: Character,
    players: Players,
    playersActions: PlayersActions,
    status: GameStatus,
    ...
}

const db = typedRealTimeDB<Game>()

Example

For reference the interface demoed looks like this

Typed Firebase Doc

Tab-able

$ methods

This utility provides helper methods to automatically turn db references into queries or listeners. These are denoted by the $. Also the are fully typed by inference. So your handler functions will be checked automagically.

type inference

type inference

Package exports

  • typedAdminDB
  • TypedAdminDB
  • typedRealTimeDB
  • TypedRealTimeDB

TODO

  • proof of concept for admin firebase functions
  • proof of concept for realtime database
  • proof of concept for firestore
  • add and document list of all firebase methods

About

Typescript utility for firebase. Provides intellisense and type safety for realtime db and firestore methods and documents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published