Skip to content

Commit

Permalink
Update lib types to mark Annex B as deprecated (#43710)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
petamoriken and typescript-bot committed Aug 30, 2021
1 parent 7849342 commit d699bcd
Show file tree
Hide file tree
Showing 49 changed files with 3,285 additions and 238 deletions.
18 changes: 15 additions & 3 deletions src/harness/fourslashInterfaceImpl.ts
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
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
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
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
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

0 comments on commit d699bcd

Please sign in to comment.