Couldn't you just check for `ts.writeChunk !== null`?