Passing Type Arguments
Here we're creating a set of guitarists and adding Jimi Hendrix and Eric Clapton to it.
We also have the
// @ts-expect-error directive because we expect an error to be thrown we try to add a non-string to the set.
However, our error isn't being thrown because the
guitarists set is not strictly typed as a set of strings.
We see this same issue when hovering over the
guitaristsAsArray variable inside of the array test:
Hovering shows us that
guitaristsAsArray is an
Your challenge is to update
guitarists to be typed a set of strings.
We're also expecting an error to throw here when you add a non-string to that set. If I remove this, then this should be erroring here, but it's not. For some reason, our set isn't being strictly typed as a set of strings. We've got it here, too, "Should be typed as an array of strings."
When we get our guitaristsAsArray here, when we call Array.from guitarists, then it should be returning a type which is a string array, but it's not. It's saying it's unknown array. Your challenge is to figure out -- I'll give you a clue, it's on this line -- how to type this set as a set of strings and not just what it is now, which is a set unknown.