-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USVString type definition #28775
Comments
Our IDL-based generator just interprets |
Some of our modules as well as some external NPM modules we are using need USVString as a type. Even though I agree that it is rather pointless from a programming point of view as it just maps to a string, it serves a purpose as it gives developers useful informations about what is permissible. furthermore, it is still defined by webIDL and the removal was not documented so figuring why some code suddenly refuses to compile might be a bit of a headache. |
Let's discuss in person tomorrow |
Hey folks. What needs to happen on this type so we can merge it? Or is |
I have been pretty much bothered with the way typescript handles a USVString dose lots of conversion casting mostly anything to a string, it deals with Here are some example // This works fine and it's totally valid in vanilla js!
async function get (req) {
const url = new URL(req)
url.searchParams.set('api_key', '---')
return fetch(url)
} TS throws for using fetch in this way...
Line 19650 in cec2fda
it shouldn't be a regular string. It should be a USVString instead! Same thing with blobs! - type BlobPart = BufferSource | Blob | string;
+ type BlobPart = BufferSource | Blob | USVString; |
I've just been caught out by this when trying to move from
|
TypeScript Version: 3.2.0-dev.201xxxxx
Search Terms:
USVString
Code
Expected behavior:
Until typescript version 3.0.3 USVString used to be an existing type defined in
lib.dom.d.ts
in version 3.1, according to the breaking changes page, some vendor-specific types are removed from lib.d.ts, a full list of removed types is included.
USVString is not on that list, yet it's type definition was also removed.
USVString is defined under webIDL, as can be seen here.
Actual behavior:
error TS2304: Cannot find name 'USVString'.
The text was updated successfully, but these errors were encountered: