For future readers
OP probably faced type error inside the exact version of @types/node.
If possible, try to upgrade @types/node package instead of type casting or creating additional objects.