-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Given some type with non-optional properties:
export interface Address {
street_address: string;
city: string;
state: string;
}
we get the following io-ts codec:
const Address = t.type({street_address: t.string, city: t.string, state: t.string})
So good so far. However, if we add a string index signature:
export interface Address {
street_address: string;
city: string;
state: string;
[k: string]: any;
}
We now get the following io-ts codec:
const Address = t.record(t.string, t.unknown)
That suits the string index signature, but we've lost validation of the three required fields.
Metadata
Metadata
Assignees
Labels
No labels