Is there a way to create a function that can take an object and return a modified version of that object in this format?
const data = {
email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e08a8f888ea0848f85ce838f8d">[email protected]</a>',
}
// I'm currently struggling with this part
type WrappedInput<T, K extends keyof T> = { [key: K]: { set: T[K] } }
function toInput<T = unknown>(data: T): WrappedInput<T> {
return {
email: {
set: data.email
}
}
}
Each key needs to be enclosed within a set
key.