Closed robbtraister closed 3 weeks ago
@robbtraister Thanks for the update. This looks good.
FYI, I added this commit after realizing the overload types for v3 and v5 aren't really necessary. (Right? If I got that wrong, please let me know.)
@robbtraister Thanks for the update. This looks good.
FYI, I added this commit after realizing the overload types for v3 and v5 aren't really necessary. (Right? If I got that wrong, please let me know.)
Calling v3("value", "namespace")
should always return string
, but removing the overloads types it as string | Uint8Array
.
Having said that, I only ever use v4
, so 🤷
Calling v3("value", "namespace") should always return string, but removing the overloads types it as string | Uint8Array.
Ah, right... thanks for catching that!
The
v4
function is guaranteed to return a string unless thebuf
argument is provided. By modifying the signature to denote this parameter as required for theUint8Array
case, we get the benefit of a stricter return type ofstring
when simply callingv4()
.