How to use generics as required fields in Typescript?
I have an interface:
interface IData {
id?: string
name: string
description?: string
}
Sometimes id is required, sometimes - description
I want to use generics for required fields. How can I do it??
example how I can use it:
interface IBookShop {
id: string
name: string
books: IData<'id', 'name', 'description'> //this fields should be required
}