Object types

There are several behaviors of object types that a TypeScript developer should be aware of.

Loading TypeScript...

You can extend the function above to use T[K] in an Array type specification.

Loading TypeScript...

Type safe form fields

Let's consider a practical example where we are receiving objects from a form. This example illustrates how you can even used indexed access to construct a mapping between value types.

Suppose we now want a function that accepts Field objects and produces the correct value type.

Was this page helpful?