面试题答案
一键面试function processValue(input: any): number {
if (
typeof input === 'object' &&
'id' in input &&
typeof input.id === 'number' &&
'name' in input &&
typeof input.name ==='string'
) {
return input.name.length + input.id;
}
return -1;
}