62. 中序遍历
中等
实现二叉树中序遍历的类型版本。
例如:
const tree1 = {
val: 1,
left: null,
right: {
val: 2,
left: {
val: 3,
left: null,
right: null,
},
right: null,
},
} as const
type A = InorderTraversal<typeof tree1> // expected to be [1, 3, 2]