Skip to content

Commit d699bcd

Browse files
Update lib types to mark Annex B as deprecated (#43710)
* Mark properties defined in Annex B as deprecated * Tweak * Update baselines * Update fourslash tests * Add completionsStringMethods.ts test * Fix sortText value in fourslash test for deprecated tags * Update package-lock.json * Update package-lock.json * Mark Non-standard RegExp Constructor properties as deprecated * Update baselines Co-authored-by: TypeScript Bot <[email protected]>
1 parent 7849342 commit d699bcd

File tree

49 files changed

+3285
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3285
-238
lines changed

src/harness/fourslashInterfaceImpl.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,12 @@ namespace FourSlashInterface {
971971
kindModifiers: "declare",
972972
sortText: SortText.GlobalsOrKeywords
973973
});
974+
const deprecatedFunctionEntry = (name: string): ExpectedCompletionEntryObject => ({
975+
name,
976+
kind: "function",
977+
kindModifiers: "deprecated,declare",
978+
sortText: SortText.DeprecatedGlobalsOrKeywords
979+
});
974980
const varEntry = (name: string): ExpectedCompletionEntryObject => ({
975981
name,
976982
kind: "var",
@@ -994,6 +1000,12 @@ namespace FourSlashInterface {
9941000
kindModifiers: "declare",
9951001
sortText: SortText.LocationPriority
9961002
});
1003+
const deprecatedMethodEntry = (name: string): ExpectedCompletionEntryObject => ({
1004+
name,
1005+
kind: "method",
1006+
kindModifiers: "deprecated,declare",
1007+
sortText: SortText.DeprecatedLocationPriority
1008+
});
9971009
const propertyEntry = (name: string): ExpectedCompletionEntryObject => ({
9981010
name,
9991011
kind: "property",
@@ -1227,7 +1239,7 @@ namespace FourSlashInterface {
12271239
methodEntry("toLocaleUpperCase"),
12281240
methodEntry("trim"),
12291241
propertyEntry("length"),
1230-
methodEntry("substr"),
1242+
deprecatedMethodEntry("substr"),
12311243
methodEntry("valueOf"),
12321244
];
12331245

@@ -1331,8 +1343,8 @@ namespace FourSlashInterface {
13311343
functionEntry("decodeURIComponent"),
13321344
functionEntry("encodeURI"),
13331345
functionEntry("encodeURIComponent"),
1334-
functionEntry("escape"),
1335-
functionEntry("unescape"),
1346+
deprecatedFunctionEntry("escape"),
1347+
deprecatedFunctionEntry("unescape"),
13361348
varEntry("NaN"),
13371349
varEntry("Infinity"),
13381350
varEntry("Object"),

src/lib/es2015.core.d.ts

+53-13
Original file line numberDiff line numberDiff line change
@@ -435,47 +435,87 @@ interface String {
435435

436436
/**
437437
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
438+
* @deprecated A legacy feature for browser compatibility
438439
* @param name
439440
*/
440441
anchor(name: string): string;
441442

442-
/** Returns a `<big>` HTML element */
443+
/**
444+
* Returns a `<big>` HTML element
445+
* @deprecated A legacy feature for browser compatibility
446+
*/
443447
big(): string;
444448

445-
/** Returns a `<blink>` HTML element */
449+
/**
450+
* Returns a `<blink>` HTML element
451+
* @deprecated A legacy feature for browser compatibility
452+
*/
446453
blink(): string;
447454

448-
/** Returns a `<b>` HTML element */
455+
/**
456+
* Returns a `<b>` HTML element
457+
* @deprecated A legacy feature for browser compatibility
458+
*/
449459
bold(): string;
450460

451-
/** Returns a `<tt>` HTML element */
461+
/**
462+
* Returns a `<tt>` HTML element
463+
* @deprecated A legacy feature for browser compatibility
464+
*/
452465
fixed(): string;
453466

454-
/** Returns a `<font>` HTML element and sets the color attribute value */
467+
/**
468+
* Returns a `<font>` HTML element and sets the color attribute value
469+
* @deprecated A legacy feature for browser compatibility
470+
*/
455471
fontcolor(color: string): string;
456472

457-
/** Returns a `<font>` HTML element and sets the size attribute value */
473+
/**
474+
* Returns a `<font>` HTML element and sets the size attribute value
475+
* @deprecated A legacy feature for browser compatibility
476+
*/
458477
fontsize(size: number): string;
459478

460-
/** Returns a `<font>` HTML element and sets the size attribute value */
479+
/**
480+
* Returns a `<font>` HTML element and sets the size attribute value
481+
* @deprecated A legacy feature for browser compatibility
482+
*/
461483
fontsize(size: string): string;
462484

463-
/** Returns an `<i>` HTML element */
485+
/**
486+
* Returns an `<i>` HTML element
487+
* @deprecated A legacy feature for browser compatibility
488+
*/
464489
italics(): string;
465490

466-
/** Returns an `<a>` HTML element and sets the href attribute value */
491+
/**
492+
* Returns an `<a>` HTML element and sets the href attribute value
493+
* @deprecated A legacy feature for browser compatibility
494+
*/
467495
link(url: string): string;
468496

469-
/** Returns a `<small>` HTML element */
497+
/**
498+
* Returns a `<small>` HTML element
499+
* @deprecated A legacy feature for browser compatibility
500+
*/
470501
small(): string;
471502

472-
/** Returns a `<strike>` HTML element */
503+
/**
504+
* Returns a `<strike>` HTML element
505+
* @deprecated A legacy feature for browser compatibility
506+
*/
473507
strike(): string;
474508

475-
/** Returns a `<sub>` HTML element */
509+
/**
510+
* Returns a `<sub>` HTML element
511+
* @deprecated A legacy feature for browser compatibility
512+
*/
476513
sub(): string;
477514

478-
/** Returns a `<sup>` HTML element */
515+
/**
516+
* Returns a `<sup>` HTML element
517+
* @deprecated A legacy feature for browser compatibility
518+
*/
479519
sup(): string;
480520
}
481521

src/lib/es2019.string.d.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ interface String {
55
/** Removes the leading white space and line terminator characters from a string. */
66
trimStart(): string;
77

8-
/** Removes the leading white space and line terminator characters from a string. */
8+
/**
9+
* Removes the leading white space and line terminator characters from a string.
10+
* @deprecated A legacy feature for browser compatibility. Use `trimStart` instead
11+
*/
912
trimLeft(): string;
1013

11-
/** Removes the trailing white space and line terminator characters from a string. */
14+
/**
15+
* Removes the trailing white space and line terminator characters from a string.
16+
* @deprecated A legacy feature for browser compatibility. Use `trimEnd` instead
17+
*/
1218
trimRight(): string;
1319
}

src/lib/es5.d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ declare function encodeURIComponent(uriComponent: string | number | boolean): st
6464

6565
/**
6666
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
67+
* @deprecated A legacy feature for browser compatibility
6768
* @param string A string value
6869
*/
6970
declare function escape(string: string): string;
7071

7172
/**
7273
* Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
74+
* @deprecated A legacy feature for browser compatibility
7375
* @param string A string value
7476
*/
7577
declare function unescape(string: string): string;
@@ -483,6 +485,7 @@ interface String {
483485
// IE extensions
484486
/**
485487
* Gets a substring beginning at the specified location and having the specified length.
488+
* @deprecated A legacy feature for browser compatibility
486489
* @param from The starting position of the desired substring. The index of the first character in the string is zero.
487490
* @param length The number of characters to include in the returned substring.
488491
*/
@@ -924,6 +927,7 @@ interface RegExp {
924927
lastIndex: number;
925928

926929
// Non-standard extensions
930+
/** @deprecated A legacy feature for browser compatibility */
927931
compile(): this;
928932
}
929933

@@ -935,16 +939,44 @@ interface RegExpConstructor {
935939
readonly prototype: RegExp;
936940

937941
// Non-standard extensions
942+
/** @deprecated A legacy feature for browser compatibility */
938943
$1: string;
944+
/** @deprecated A legacy feature for browser compatibility */
939945
$2: string;
946+
/** @deprecated A legacy feature for browser compatibility */
940947
$3: string;
948+
/** @deprecated A legacy feature for browser compatibility */
941949
$4: string;
950+
/** @deprecated A legacy feature for browser compatibility */
942951
$5: string;
952+
/** @deprecated A legacy feature for browser compatibility */
943953
$6: string;
954+
/** @deprecated A legacy feature for browser compatibility */
944955
$7: string;
956+
/** @deprecated A legacy feature for browser compatibility */
945957
$8: string;
958+
/** @deprecated A legacy feature for browser compatibility */
946959
$9: string;
960+
/** @deprecated A legacy feature for browser compatibility */
961+
input: string;
962+
/** @deprecated A legacy feature for browser compatibility */
963+
$_: string;
964+
/** @deprecated A legacy feature for browser compatibility */
947965
lastMatch: string;
966+
/** @deprecated A legacy feature for browser compatibility */
967+
"$&": string;
968+
/** @deprecated A legacy feature for browser compatibility */
969+
lastParen: string;
970+
/** @deprecated A legacy feature for browser compatibility */
971+
"$+": string;
972+
/** @deprecated A legacy feature for browser compatibility */
973+
leftContext: string;
974+
/** @deprecated A legacy feature for browser compatibility */
975+
"$`": string;
976+
/** @deprecated A legacy feature for browser compatibility */
977+
rightContext: string;
978+
/** @deprecated A legacy feature for browser compatibility */
979+
"$'": string;
948980
}
949981

950982
declare var RegExp: RegExpConstructor;

tests/baselines/reference/completionsCommentsClass.baseline

+22-4
Original file line numberDiff line numberDiff line change
@@ -840,8 +840,8 @@
840840
{
841841
"name": "escape",
842842
"kind": "function",
843-
"kindModifiers": "declare",
844-
"sortText": "15",
843+
"kindModifiers": "deprecated,declare",
844+
"sortText": "23",
845845
"displayParts": [
846846
{
847847
"text": "function",
@@ -899,6 +899,15 @@
899899
}
900900
],
901901
"tags": [
902+
{
903+
"name": "deprecated",
904+
"text": [
905+
{
906+
"text": "A legacy feature for browser compatibility",
907+
"kind": "text"
908+
}
909+
]
910+
},
902911
{
903912
"name": "param",
904913
"text": [
@@ -921,8 +930,8 @@
921930
{
922931
"name": "unescape",
923932
"kind": "function",
924-
"kindModifiers": "declare",
925-
"sortText": "15",
933+
"kindModifiers": "deprecated,declare",
934+
"sortText": "23",
926935
"displayParts": [
927936
{
928937
"text": "function",
@@ -980,6 +989,15 @@
980989
}
981990
],
982991
"tags": [
992+
{
993+
"name": "deprecated",
994+
"text": [
995+
{
996+
"text": "A legacy feature for browser compatibility",
997+
"kind": "text"
998+
}
999+
]
1000+
},
9831001
{
9841002
"name": "param",
9851003
"text": [

0 commit comments

Comments
 (0)