Skip to content

Commit c2f0c58

Browse files
wbhobmhegazy
authored andcommitted
add types for escape and unescape methods microsoft#18813 (microsoft#19015)
* add types for escape and unescape methods microsoft#18813 although the issue is marked working as expected, it is important to mention that most major browsers maintain support for escape and unescape, and some javascript codebases moving to typescript may have escape and unescape in them. They are valid JavaScript, and thus they should be included in the global definition. * add escape and unescape types to lib in tests * update tests to turn CI green
1 parent e7df832 commit c2f0c58

File tree

5 files changed

+847
-823
lines changed

5 files changed

+847
-823
lines changed

src/lib/es5.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ declare function encodeURI(uri: string): string;
6262
*/
6363
declare function encodeURIComponent(uriComponent: string): string;
6464

65+
/**
66+
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
67+
* @param string A string value
68+
*/
69+
declare function escape(string: string): string;
70+
71+
/**
72+
* Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
73+
* @param string A string value
74+
*/
75+
declare function unescape(string: string): string;
76+
6577
interface PropertyDescriptor {
6678
configurable?: boolean;
6779
enumerable?: boolean;

tests/cases/fourslash/completionInJSDocFunctionNew.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
////var f = function () { return new/**/; }
77

88
goTo.marker();
9-
verify.completionListCount(115);
9+
verify.completionListCount(117);
1010
verify.completionListContains('new');

tests/cases/fourslash/completionInJSDocFunctionThis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
////var f = function (s) { return this/**/; }
66

77
goTo.marker();
8-
verify.completionListCount(116);
8+
verify.completionListCount(118);
99
verify.completionListContains('this');
1010

tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
//// var x = </**/;
55

66
goTo.marker();
7-
verify.completionListCount(42);
7+
verify.completionListCount(44);

0 commit comments

Comments
 (0)