#StackBounty: #typescript #types #fp-ts Io-ts interface for properties with unknown keys

Bounty: 100

I’m trying to create an io-ts interface of the following


export interface myInterface {
  [key:string]?: string | undefined | null

I want to turn this into the io-ts equivalent. The end goal is to combine it with another existing io-ts interface


export const MyOtherInterfaceV = t.interface({
  requiredProp1: ValidString// custom type, checks string is populated
  requiredProp2: ValidString
  // All other fields marked as required

export type MyOtherInterface = t.TypeOf<typeof MyOtherInterfaceV>;

The idea is I need a type to represent a payload which will have some fields we require and must be valid, and some that we don’t know about and can be optional. We want to combine these for use later on in processing, eventually being stored in dynamodb

Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.