Another solution for Q14: declare precise value in interface
Author: zmzloisCreated Dec 27, 2022Updated Mar 29, 2023
.....
interface User {
id: string;
firstName: string;
lastName: string;
}
interface Post {
id: User["id"];
title: string;
body: string;
}
interface Comment {
id: User["id"];
comment: string;
}Source: total-typescript/beginners-typescript-tutorial