You could use `uv_guess_handle_type` and if `UV_TTY` is returned use a `uv_tty_t` handle, else use the current approach.