我有一个valuesToUpperCase
泛型,我想把一个类型作为输入,把它的值大写并返回
我尝试过此方法,但得到错误消息'toUppercase' implicitly has an 'any' return type
type GeneralType = {
name: string;
car: string;
}
type valuesToUpperCase<T extends GeneralType> = {
name: T['firstName'].toUpperCase(),
car: T['lastName'].toUpperCase(),
}
1条答案
按热度按时间o4tp2gmn1#
Playground