Skip to content

Instantly share code, notes, and snippets.

@gund
Created October 5, 2018 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gund/83782c57e6981db9193cbcbdd5b4d069 to your computer and use it in GitHub Desktop.
Save gund/83782c57e6981db9193cbcbdd5b4d069 to your computer and use it in GitHub Desktop.
TS spread bug
// EXPECTED
new Set(...document.body.classList)
> {"l", "o", "g", "e", "d", …}

// ACTUAL
new (Set.bind.apply(Set, [void 0].concat(document.body.classList)))();
> {"logged-in", "env-production", "emoji-size-boost"}

// FIX
new (Set.bind.apply(Set, [void 0].concat(Array.prototype.slice.call(document.body.classList))))();
{"l", "o", "g", "e", "d", }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment