Answer the question
In order to leave comments, you need to log in
How to pass a function argument, for a complex object?
There is a complex object
const obj:DataType = {
val0:boolean,
val1:string,
val2:null | undefined | string
val3: {
field0:[string, string]
field1: {
word:string
},
val4:[
{text0: true, text2:{}}
]
}
}
function changeField(data:DataType, fieldName:keyof DataType, val:any) {
data[fieldName] = val
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question