firebase-typed
v0.3.0
Published
Typescript utility for firebase. Provides intellisense and type safety for realtime db and firestore methods and documents.
Downloads
7
Maintainers
Readme
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
$
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.
Package exports
- typedAdminDB
- TypedAdminDB
- typedRealTimeDB
- TypedRealTimeDB
TODO
- [x] proof of concept for admin firebase functions
- [x] proof of concept for realtime database
- [ ] proof of concept for firestore
- [ ] add and document list of all firebase methods