Earlier quoted context omitted.
Not the only way. California and Washington have legal protections for employees. IP you create outside working hours, on your own hardware, and wholly unrelated to your job, is your own.
The question becomes what is wholly unrelated. If I'm hired to program, some might argue that any code I write is not wholly unrelated to my work.
https://law.justia.com/codes/california/2011/lab/division-3/...