Type 'string' is not assignable to type 'number' when using property binding in an Angular template

Viewed 3665

Getting the following errors:

Error: src/app/pages/journal-list/journal-list.component.html:27:23 - error TS2322: Type 'string' is not assignable to type 'number'.
    
    27 [title]="entry.title" [date]="entry.date"
                             ~~~~~~~~~~~~~~~~~~~
    
      src/app/pages/journal-list/journal-list.component.ts:7:16
        7   templateUrl: './journal-list.component.html',
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Error occurs in the template of component JournalListComponent.
    src/app/pages/journal-list/journal-list.component.html:26:1 - error TS2322: Type 'number' is not assignable to type 'string | any[] | null | undefined'.
    
    26 [routerLink] ="i"
       ~~~~~~~~~~~~~~~~~
    
      src/app/pages/journal-list/journal-list.component.ts:7:16
        7   templateUrl: './journal-list.component.html',
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Error occurs in the template of component JournalListComponent.

Apparently because I'm using the property binding [date]="entry.date". I've declared property date as a number. Why does this occur?

Code snippet for context:

 <div class="entries-list">
<app-journal-entry *ngFor="let entry of entries; index as i"
[routerLink] ="i" 
[title]="entry.title" [date]="entry.date" 
[body]="entry.body"></app-journal-entry>

</div>
1 Answers
Related