Skip to content

Commit aa36d21

Browse files
authored
fix(dts-generator): align deprecation/experimental tags with UI5 SDK (#469)
Fixes: #468
1 parent ea65c9d commit aa36d21

File tree

8 files changed

+1481
-1459
lines changed

8 files changed

+1481
-1459
lines changed

packages/dts-generator/src/phases/dts-code-gen.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ function JSDOC({
118118
}
119119

120120
contents += since ? `@since ${since}` + NL : EMPTY_STRING;
121-
contents += deprecated ? genDeprecated(deprecated) + NL : EMPTY_STRING;
122-
contents += experimental ? genExperimental(experimental) + NL : EMPTY_STRING;
121+
contents += deprecated
122+
? genDeprecatedOrExperimental(deprecated) + NL
123+
: EMPTY_STRING;
124+
contents += experimental
125+
? genDeprecatedOrExperimental(experimental) + NL
126+
: EMPTY_STRING;
123127
contents += isProtected
124128
? genProtected({ callable: kind === "FunctionDesc" }) + NL
125129
: EMPTY_STRING;
@@ -219,11 +223,15 @@ function NAMED_INTERFACE_MARKER(fqn: string): string {
219223
* @param ast
220224
* @return
221225
*/
222-
function genDeprecated(ast: DeprecatedDesc) {
226+
function genDeprecatedOrExperimental(ast: DeprecatedDesc | ExperimentalDesc) {
223227
let contents = EMPTY_STRING;
224-
contents += "@deprecated";
225-
contents += ast.since ? ` (since ${ast.since})` : EMPTY_STRING;
226-
contents += ast.description ? ` - ${ast.description}` : EMPTY_STRING;
228+
if (ast.kind === "DeprecatedDesc") {
229+
contents += "@deprecated";
230+
} else if (ast.kind === "ExperimentalDesc") {
231+
contents += "@experimental";
232+
}
233+
contents += ast.since ? ` As of version ${ast.since}.` : EMPTY_STRING;
234+
contents += ast.description ? ` ${ast.description}` : EMPTY_STRING;
227235
return contents;
228236
}
229237

@@ -236,18 +244,6 @@ function genProtected({ callable = false }) {
236244
: "@ui5-protected DO NOT USE IN APPLICATIONS (only for related classes in the framework)";
237245
}
238246

239-
/**
240-
* @param ast
241-
* @return
242-
*/
243-
function genExperimental(ast: ExperimentalDesc) {
244-
let contents = EMPTY_STRING;
245-
contents += "@experimental";
246-
contents += ast.since ? ` (since ${ast.since})` : EMPTY_STRING;
247-
contents += ast.description ? ` - ${ast.description}` : EMPTY_STRING;
248-
return contents;
249-
}
250-
251247
/**
252248
*
253249
* @param ast

packages/dts-generator/src/resources/core-preamble.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
6464

6565
/**
6666
* Extension function to the jQuery.fn which identifies SAPUI5 controls in the given jQuery context.
67-
* @deprecated since 1.106, use sap.ui.core.Element.closestTo instead.
67+
* @deprecated As of version 1.106, use {@link sap.ui.core.Element.closestTo} instead.
6868
*/
6969
control(
7070
/**
@@ -75,7 +75,7 @@ interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
7575

7676
/**
7777
* Extension function to the jQuery.fn which identifies SAPUI5 controls in the given jQuery context.
78-
* @deprecated since 1.106, use sap.ui.core.Element.closestTo instead.
78+
* @deprecated As of version 1.106, use {@link sap.ui.core.Element.closestTo} instead.
7979
*/
8080
control(
8181
/**

0 commit comments

Comments
 (0)