I have a function defined as follows:
interface ExtraModels extends Model {
unknown: string
}
const write = async (data: ExtraModels[]) => {
console.log(data[0].unknown)
}
This function is currently working. However, I want to modify it to:
const write = async <T = ExtraModels>(data: T[]) => {
console.log(data[0].unknown)
}
Unfortunately, when I make this change, I encounter the following error:
Property 'unknown' does not exist on type 'T'.ts(2339)
I'm confused as to why this error is occurring. Based on my understanding, this should be a valid modification.