Dima Malko
Dima Malko

Reputation: 283

Creating model in Typescript, how to import Timestamp firebase

This is my first Typescript project. I try to make model for my firebase collection with events.

here is my IEvent:

import { DocumentReference, Timestamp } from "../types/Firebase";

export default interface IEvent {
  createdAt: Timestamp;
  creator: DocumentReference;
  date: Timestamp;
  deletedAt: Timestamp | null;
  eventName: string;
  eventNote: string;
  hasTime: Boolean;
  maxPeople: number;
  publicEvent: Boolean;
  updatedAt: Timestamp | null;
}

Console throw this error

Cannot find module '../types/Firebase' or its corresponding type declarations. TS2307

What is the right way, to import DocumentReference and Timestamp?

Upvotes: 0

Views: 554

Answers (1)

Merli Mejia
Merli Mejia

Reputation: 61

You need to install the types declarations.

Using the command line, go to your project folder and type:

npm i @firebase/firestore-types

Reference: https://www.npmjs.com/package/@firebase/firestore-types

Upvotes: 1

Related Questions