We can save all evaluated commands from our TSX REPL session to a file:

$ npx tsx
> const name: number = "Jake"
undefined
> .save output.ts
Session saved to: output.ts

One use case would be evaluating that output with tsc to get compilation and type-checking:

$ npx tsc output.ts
output.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'.

1 const name: number = "Jake"
        ~~~~~~~~


Found 1 error in output.ts:1

See .help inside TSX for more info about this and other meta commands.