Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript add object to object

interface MyType extends Record<string,any> {
    typesafeProp1?: number,
    requiredProp1: string,
}

/**
Record<Keys,Type> is a Utility type in typescript.
It is a much cleaner alternative for key-value pairs 
where property-names are not known. 
It's worth noting that Record<Keys,Type> is a named alias to {[k: Keys]: Type} 
where Keys and Type are generics.
*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #add #object #object
ADD COMMENT
Topic
Name
8+5 =