Skip to content
Advertisement

How do I type-check this object in Typescript

I am in a state of confusion on how I would go about type-checking this variable, but I am not able to do it.

What I understand is that this is an object which contains fields, but these fields are written in a obscure way.

The object is called userApproval

Here is the object when I output it to console.

JavaScript

Now this is the type I am attempting to type to,

JavaScript

Is this correct

Advertisement

Answer

I think the keys of your object are example.test so based on that try this types.

JavaScript
Advertisement