TS2551

error TS2551: Property ‘title‘ does not exist on type ‘Video‘. Did you mean ‘titles‘?

Broken Code ❌

1
2
3
4
5
6
7
interface Video {
titles: string;
}

function showEpisode(this: Video, tag: string) {
console.log(`${this.title} - ${tag}`);
}

Fixed Code ✔️

There is a typo in our code which TypeScript’s compiler has caught for us. We have to rename the titles property:

1
2
3
4
5
6
7
interface Video {
title: string;
}

function showEpisode(this: Video, tag: string) {
console.log(`${this.title} - ${tag}`);
}