DEV Community

Discussion on: Getting Started with Angular, Akita & Firebase

Collapse
 
santiagolarsen profile image
santiagolarsen • Edited

Hi! I'm learning how to use Akita and Firebase and I found a problem in the books service while trying to implement this. It appears that the addBook() function has a problem with the types of the input and output data, and get an error such as:

ERROR in src/app/state/books.service.ts:30:1 - error TS1128: Declaration or statement expected.
30 }
   ~
    ERROR in src/app/state/books.service.ts:19:25 - error TS2345: Argument of type '{ title: string; }' is not assignable to parameter of type 'Book'.
      Property 'id' is missing in type '{ title: string; }' but required in type 'Book'.

    19     this.collection.add({title});
                               ~~~~~~~
      src/app/state/book.model.ts:4:2
        4  id: ID;
           ~~
        'id' is declared here.

If I assigned a type of Book to the title parameter angular stops complaining about that but has problems elsewhere. I know it's asking for the id: property to get passed so I don't know if there's
anything I'm missing ? Thank you.