-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Missing escape/unescape ? #8639
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
Comments
The global If you want to use them, just add the definitions: declare function escape(s:string): string; |
@mhegazy It seems nothing refer to that they are deprecated ? |
@k8w those pages used to refer to it being deprecated, and it was. It does not appear to be deprecated in the current standard though, and I can't find a specific reference to why the change was made. I suspect they were retained in the specification to not break code, but you shouldn't be using them for new code as they don't handle Unicode URIs properly, and so IMO they are best to leave out and people can add them back in if they are supporting old code. |
That is my recollection as well.. good that i am not crazy :) I checked with @bterlson, and seems that back then there was a proposal to deprecate Annex B (where all previous mistakes have lived), but then that did not happen. i am assuming that why the deprecation notice was added, then removed. That said, i do not think we should be in the business of policing ppl's use of APIs. the library should be an accurate model of the JS engine at runtime.. reopening. |
Reading the Annex B header
It really seems like this should not be in lib.d.ts. People are going to find this, use it instead of a working escape function like |
That is the intention of Annex B, but node supports it as well as all main browsers.. so it is really a standard.. we can have a |
A pragmatic viewpoint is better than one informed by the letter of the standard IMO. I came down on the side of supporting escape/unescape in lib.d.ts because in practice these APIs are supported universally across script engines and used heavily across the web and, despite what Annex B hoped, aren't going anywhere afaict. On the other hand, not having these APIs in lib.d.ts is likely to cause friction and may not prevent people from using it, and may not be effective at driving people toward better APIs. I also note that we have other things from Annex B in lib.d.ts already, including my best friend String.prototype.blink! I feel like encode/decode should be in too unless we really want to stand on the principle that these APIs are just so bad they should not be used. Annex B shouldn't really factor in to this decision. |
Compromise at #19299 |
We could also split the baby again by making people write |
My opinion is that it is a good compromise with #19299. Splitting the baby again with |
@mhegazy @RyanCavanaugh |
Actually, I think I see what you mean; you're talking about 8-bit codes? |
@DanielRosenwasser Now I'm not sure what you mean, but yeah, it's possible we're talking about the same thing 😄 |
In this repo, https://github.com/jecovier/vue-json-excel/blob/master/JsonExcel.vue#L175. To achieve feeding btoa with data contains special characters, it is necessary to use |
This was already fixed by #19015 , cc @jakebailey |
Makes me sad actually 🥲 |
Well they're marked as |
TypeScript Version:
1.8
Code
Expected behavior:
no error
Actual behavior:
can not find name 'escape'
can not find name 'unescape'
by the way, typescript playground experience is terrible when use Microsoft Edge (input chinese charactors , click a new line , select code)
The text was updated successfully, but these errors were encountered: