K
K
kodwi2017-03-06 22:30:37
typescript
kodwi, 2017-03-06 22:30:37

How to get an array of interface field names?

Is there any analogue of Object.keys()? To work without creating a specific object, but from a pure interface.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
abberati, 2017-03-07
@abberati

Your output is enum. An interface is a fairly virtual entity that exists only up to the compilation level. There are no interfaces in the runtime, which means there is nowhere to bypass the fields.

S
srgshpp, 2017-03-09
@srgshpp

keyof?
https://www.typescriptlang.org/docs/handbook/relea...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question