# Typeof 类型运算符

type Predicate = (x: unknown) => boolean;
type K = ReturnType<Predicate>;



function f() {
  return { x: 10, y: 3 };
}
type P = ReturnType<typeof f>;
1
2
3
4
5
6
7
8
9

# 获取数组的每一项

const arr = ['red','greed',1] as const

type A = typeof arr[number];
type B = typeof arr;

type C = `A_${A}`
1
2
3
4
5
6