Donald Trump has celebrated after a court decision that will cost Democrats dearly in the upcoming midterm elections.