Accept any type that satisifies that other type in function

Is there like
type AWithFields = {
foo: string
}

const mapper = <T satisifies AWithFields>(param: T) => {
// update param fields here and return
return param
}
type AWithFields = {
foo: string
}

const mapper = <T satisifies AWithFields>(param: T) => {
// update param fields here and return
return param
}
I wanted to accept any param that satisifies AWithFields in the function.
1 Reply
ChooKing
ChooKingā€¢8mo ago
const mapper = <T extends AWithFields>(param: T) => {
// update param fields here and return
return param
}
const mapper = <T extends AWithFields>(param: T) => {
// update param fields here and return
return param
}