0

查看一些 TypeScript 代码,我遇到了这个问题,但我不确定这意味着什么:

type data = {
  serial_number: string;
  hub_sn: string;
};

type rapid = data & {
  type: "rapid";
  ob: number[];
};

我看到一个听众快速引用:

listen.on("rapid", async (data: rapid) => {
  const [ts, ob] = decodeRapid(data.ob);
  const body = `rapid,station=${data.serial_number} ${
    serialize(ob)
  } ${ts}`;
  const response = await writeToInfluxDB(body);
  console.log(JSON.stringify({ response, body }));
});

我对如何将来自侦听器的数据输入对象有点迷失?

4

0 回答 0