V
V
ver-siarhei2021-10-28 19:29:54
typescript
ver-siarhei, 2021-10-28 19:29:54

How to enumerate typescript interfaces?

I have several interfaces to work with tmdb database. There is an interface for the input parameters in the request, there is an interface for the data received from the request. I'd like to somehow combine them into an enum. That is, there will be one supposedly ITMDB object, and so that when writing ITMDB.response there is a response interface, and ITMDB.params is the parameter interface in the request. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-10-28
@ver-siarhei

namespace ITMDB {
  export interface params {}; 
  export interface response {}; 
}

Could be so:
interface ITMDB {
  params: {}; 
  response: {}; 
}

But then, alas, to specific keys - only by literals:
ITMDB['response']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question