I'm codding some library with TypeScript, and I want to protect calls my methods from incorrect meaning data. Let's see next example:
type BookId = number;
type AuthorId = number;
BooksService.getById(bookId: BookId): Book {
// ...
};
let authorId: AuthorId;
// I need to get some type error in next lene, because getById() expect receive BookId, not AuthorId:
book = BooksService.getById(authorId);
Is it possible to get this error? How to upgrade my example to get it?