Washington state has voted for a measure that will ban sales of gas-powered cars by 2030, years before California.