Skip to content

Update lib types to mark Annex B as deprecated #43710

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

Merged
merged 13 commits into from
Aug 30, 2021
18 changes: 15 additions & 3 deletions src/harness/fourslashInterfaceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,12 @@ namespace FourSlashInterface {
kindModifiers: "declare",
sortText: SortText.GlobalsOrKeywords
});
const deprecatedFunctionEntry = (name: string): ExpectedCompletionEntryObject => ({
name,
kind: "function",
kindModifiers: "deprecated,declare",
sortText: SortText.DeprecatedGlobalsOrKeywords
});
const varEntry = (name: string): ExpectedCompletionEntryObject => ({
name,
kind: "var",
Expand All @@ -994,6 +1000,12 @@ namespace FourSlashInterface {
kindModifiers: "declare",
sortText: SortText.LocationPriority
});
const deprecatedMethodEntry = (name: string): ExpectedCompletionEntryObject => ({
name,
kind: "method",
kindModifiers: "deprecated,declare",
sortText: SortText.DeprecatedLocationPriority
});
const propertyEntry = (name: string): ExpectedCompletionEntryObject => ({
name,
kind: "property",
Expand Down Expand Up @@ -1227,7 +1239,7 @@ namespace FourSlashInterface {
methodEntry("toLocaleUpperCase"),
methodEntry("trim"),
propertyEntry("length"),
methodEntry("substr"),
deprecatedMethodEntry("substr"),
methodEntry("valueOf"),
];

Expand Down Expand Up @@ -1331,8 +1343,8 @@ namespace FourSlashInterface {
functionEntry("decodeURIComponent"),
functionEntry("encodeURI"),
functionEntry("encodeURIComponent"),
functionEntry("escape"),
functionEntry("unescape"),
deprecatedFunctionEntry("escape"),
deprecatedFunctionEntry("unescape"),
varEntry("NaN"),
varEntry("Infinity"),
varEntry("Object"),
Expand Down
66 changes: 53 additions & 13 deletions src/lib/es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,47 +435,87 @@ interface String {

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

/** Returns a `<big>` HTML element */
/**
* Returns a `<big>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
big(): string;

/** Returns a `<blink>` HTML element */
/**
* Returns a `<blink>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
blink(): string;

/** Returns a `<b>` HTML element */
/**
* Returns a `<b>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
bold(): string;

/** Returns a `<tt>` HTML element */
/**
* Returns a `<tt>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
fixed(): string;

/** Returns a `<font>` HTML element and sets the color attribute value */
/**
* Returns a `<font>` HTML element and sets the color attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontcolor(color: string): string;

/** Returns a `<font>` HTML element and sets the size attribute value */
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: number): string;

/** Returns a `<font>` HTML element and sets the size attribute value */
/**
* Returns a `<font>` HTML element and sets the size attribute value
* @deprecated A legacy feature for browser compatibility
*/
fontsize(size: string): string;

/** Returns an `<i>` HTML element */
/**
* Returns an `<i>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
italics(): string;

/** Returns an `<a>` HTML element and sets the href attribute value */
/**
* Returns an `<a>` HTML element and sets the href attribute value
* @deprecated A legacy feature for browser compatibility
*/
link(url: string): string;

/** Returns a `<small>` HTML element */
/**
* Returns a `<small>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
small(): string;

/** Returns a `<strike>` HTML element */
/**
* Returns a `<strike>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
strike(): string;

/** Returns a `<sub>` HTML element */
/**
* Returns a `<sub>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sub(): string;

/** Returns a `<sup>` HTML element */
/**
* Returns a `<sup>` HTML element
* @deprecated A legacy feature for browser compatibility
*/
sup(): string;
}

Expand Down
10 changes: 8 additions & 2 deletions src/lib/es2019.string.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ interface String {
/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;

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

/** Removes the trailing white space and line terminator characters from a string. */
/**
* Removes the trailing white space and line terminator characters from a string.
* @deprecated A legacy feature for browser compatibility. Use `trimEnd` instead
*/
trimRight(): string;
}
32 changes: 32 additions & 0 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ declare function encodeURIComponent(uriComponent: string | number | boolean): st

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

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

// Non-standard extensions
/** @deprecated A legacy feature for browser compatibility */
compile(): this;
}

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

// Non-standard extensions
/** @deprecated A legacy feature for browser compatibility */
$1: string;
/** @deprecated A legacy feature for browser compatibility */
$2: string;
/** @deprecated A legacy feature for browser compatibility */
$3: string;
/** @deprecated A legacy feature for browser compatibility */
$4: string;
/** @deprecated A legacy feature for browser compatibility */
$5: string;
/** @deprecated A legacy feature for browser compatibility */
$6: string;
/** @deprecated A legacy feature for browser compatibility */
$7: string;
/** @deprecated A legacy feature for browser compatibility */
$8: string;
/** @deprecated A legacy feature for browser compatibility */
$9: string;
/** @deprecated A legacy feature for browser compatibility */
input: string;
/** @deprecated A legacy feature for browser compatibility */
$_: string;
/** @deprecated A legacy feature for browser compatibility */
lastMatch: string;
/** @deprecated A legacy feature for browser compatibility */
"$&": string;
/** @deprecated A legacy feature for browser compatibility */
lastParen: string;
/** @deprecated A legacy feature for browser compatibility */
"$+": string;
/** @deprecated A legacy feature for browser compatibility */
leftContext: string;
/** @deprecated A legacy feature for browser compatibility */
"$`": string;
/** @deprecated A legacy feature for browser compatibility */
rightContext: string;
/** @deprecated A legacy feature for browser compatibility */
"$'": string;
}

declare var RegExp: RegExpConstructor;
Expand Down
26 changes: 22 additions & 4 deletions tests/baselines/reference/completionsCommentsClass.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,8 @@
{
"name": "escape",
"kind": "function",
"kindModifiers": "declare",
"sortText": "15",
"kindModifiers": "deprecated,declare",
"sortText": "23",
"displayParts": [
{
"text": "function",
Expand Down Expand Up @@ -899,6 +899,15 @@
}
],
"tags": [
{
"name": "deprecated",
"text": [
{
"text": "A legacy feature for browser compatibility",
"kind": "text"
}
]
},
{
"name": "param",
"text": [
Expand All @@ -921,8 +930,8 @@
{
"name": "unescape",
"kind": "function",
"kindModifiers": "declare",
"sortText": "15",
"kindModifiers": "deprecated,declare",
"sortText": "23",
"displayParts": [
{
"text": "function",
Expand Down Expand Up @@ -980,6 +989,15 @@
}
],
"tags": [
{
"name": "deprecated",
"text": [
{
"text": "A legacy feature for browser compatibility",
"kind": "text"
}
]
},
{
"name": "param",
"text": [
Expand Down
Loading