Throw a `TypeError` if trying to parse something not a string.

It makes no sense to parse something that isn't a string, so include checks for it, lest the user sees some obscure error about `indexOf`.