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 <typescriptbot@microsoft.com>
This commit is contained in:
Kenta Moriuchi
2021-08-31 02:38:07 +09:00
committed by GitHub
parent 7849342c7c
commit d699bcdaae
49 changed files with 3285 additions and 238 deletions

View File

@@ -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",
@@ -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",
@@ -1227,7 +1239,7 @@ namespace FourSlashInterface {
methodEntry("toLocaleUpperCase"),
methodEntry("trim"),
propertyEntry("length"),
methodEntry("substr"),
deprecatedMethodEntry("substr"),
methodEntry("valueOf"),
];
@@ -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"),

View File

@@ -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;
}

View File

@@ -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
src/lib/es5.d.ts vendored
View File

@@ -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;
@@ -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.
*/
@@ -924,6 +927,7 @@ interface RegExp {
lastIndex: number;
// Non-standard extensions
/** @deprecated A legacy feature for browser compatibility */
compile(): this;
}
@@ -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;