示例工程 31-tsconfig-build-pipeline

31-tsconfig-build-pipeline/01-config-matrix/src/main.ts

typescript · 0.3 KB

运行:31 · config-matrix

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

export interface Box {
  value: number;
}
 
export function read(box: Box | null | undefined): number {
  return box?.value ?? 0;
}
 
export function run(log: (msg: string) => void = console.log): string[] {
  const lines = [String(read({ value: 2 })), String(read(null))];
  for (const line of lines) {
    log(line);
  }
  return lines;
}