With TWRP unavailable for Android 10, we can still root the One Plus 5T (and other models too) with these instructions.
This guide assumes your bootloader is unlocked. If not, here is a guide. Unlocking the bootloader will reset your device to factory settings, deleting all content, so make sure to backup anything important. After unlocking, or if your bootloader is already unlocked from a previous root, we can proceed.
1-. Using your phone, download the .zip of the Oxygen OS version that you are running on your device. Regularly, the images are found here: https://www.oneplus.com/support/softwareupgrade. But For Android 10, for both OP5 and OP5T, the images are directly in the forum.
2-. Install ZArchiver. It will allow us to copy the
boot.img file inside the zip, without extracting other files. Copy that boot.img to your phone’s download directory.
3-. Install Magisk Manager from the official website: https://magiskmanager.com/ on your phone.
4-. Open Magisk Manager, click on Install -> Select and Patch a file. Now browse your downloads directory and tap on the boot.img file that we have just extracted.
5-. Once flashing is done. Copy the flashed generated file
magisk_patched.img to your computer. You can use Android File Transfer for this.
6-. Boot your phone into bootloader mode. To do this, enable advanced reboot in settings. Then press the button power for a few seconds, and you will see an option for bootloader mode.
7-. With your phone in bootloader mode, connect it to your computer, and run the following on a terminal:
fastboot flash boot magisk_patched.img
After rebooting, your phone should have root access.