Skip to content

Commit 0a00089

Browse files
committed
feat(dts-generator): hide implementation signatures in *.d.ts
1 parent d1a6894 commit 0a00089

File tree

2 files changed

+3511
-77
lines changed

2 files changed

+3511
-77
lines changed

packages/dts-generator/src/resources/typed-json-model.d.ts

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
declare module "sap/ui/model/json/TypedJSONModel" {
22
import JSONModel from "sap/ui/model/json/JSONModel";
33
import TypedJSONContext from "sap/ui/model/json/TypedJSONContext";
4+
import Context from "sap/ui/model/Context";
45

56
/**
67
* TypedJSONModel is a subclass of JSONModel that provides type-safe access to the model data. It is only available when using UI5 with TypeScript.
@@ -9,9 +10,15 @@ declare module "sap/ui/model/json/TypedJSONModel" {
910
*/
1011
export default class TypedJSONModel<Data extends object> extends JSONModel {
1112
constructor(oData?: Data, bObserve?: boolean);
12-
13+
createBindingContext<Path extends AbsoluteBindingPath<Data>>(
14+
sPath: Path,
15+
oContext?: Context,
16+
mParameters?: object,
17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
18+
fnCallBack?: Function,
19+
bReload?: boolean,
20+
): TypedJSONContext<Data, Path>;
1321
getData(): Data;
14-
1522
getProperty<Path extends AbsoluteBindingPath<Data>>(
1623
sPath: Path,
1724
): PropertyByAbsoluteBindingPath<Data, Path>;
@@ -22,18 +29,12 @@ declare module "sap/ui/model/json/TypedJSONModel" {
2229
sPath: Path,
2330
oContext: TypedJSONContext<Data, Root>,
2431
): PropertyByRelativeBindingPath<Data, Root, Path>;
25-
getProperty<
26-
Path extends AbsoluteBindingPath<Data> | RelativeBindingPath<Data, Root>,
27-
Root extends AbsoluteBindingPath<Data>,
28-
>(
29-
sPath: Path,
30-
oContext?: TypedJSONContext<Data, Root>,
31-
):
32-
| PropertyByAbsoluteBindingPath<Data, Path>
33-
| PropertyByRelativeBindingPath<Data, Root, Path>;
3432

3533
setData(data: Data): void;
3634

35+
// setProperty with AbsoluteBindingPath (context === undefined),
36+
// PLEASE NOTE: the parameter is still necessary so
37+
// the bAsyncUpdate parameter can also be used with absolute paths.
3738
setProperty<Path extends AbsoluteBindingPath<Data>>(
3839
sPath: Path,
3940
oValue: PropertyByAbsoluteBindingPath<Data, Path>,
@@ -44,31 +45,20 @@ declare module "sap/ui/model/json/TypedJSONModel" {
4445
Path extends RelativeBindingPath<Data, Root>,
4546
Root extends AbsoluteBindingPath<Data>,
4647
>(
47-
sPath: Path extends RelativeBindingPath<Data, Root> ? Path : never,
48+
sPath: Path,
4849
oValue: PropertyByRelativeBindingPath<Data, Root, Path>,
4950
oContext: TypedJSONContext<Data, Root>,
5051
bAsyncUpdate?: boolean,
5152
): boolean;
52-
setProperty<
53-
Path extends AbsoluteBindingPath<Data> | RelativeBindingPath<Data, Root>,
54-
Root extends AbsoluteBindingPath<Data>,
55-
>(
56-
sPath: Path,
57-
oValue: Path extends AbsoluteBindingPath<Data>
58-
? PropertyByAbsoluteBindingPath<Data, Path>
59-
: PropertyByRelativeBindingPath<Data, Root, Path>,
60-
oContext?: TypedJSONContext<Data, Root>,
61-
bAsyncUpdate?: boolean,
62-
): boolean;
6353
}
6454

6555
/**
6656
* Valid absolute binding in a JSONModel with the underlying type `Type`.
6757
* Counterpart to {@link PropertyByAbsoluteBindingPath}
6858
* @example
6959
* type Person = { name: string, id: number };
70-
* type PersonNamePath = PathInJSONModel<Person>; // "/name" | "/id"
71-
* let path: PersonNamePath = "/name"; // ok
60+
* type PathInPerson = PathInJSONModel<Person>; // "/name" | "/id"
61+
* let path: PathInPerson = "/name"; // ok
7262
* path = "/firstName"; // error
7363
*/
7464
export type AbsoluteBindingPath<Type> =
@@ -98,7 +88,7 @@ declare module "sap/ui/model/json/TypedJSONModel" {
9888
*
9989
* @example
10090
* type PersonWrapper = { person: { name: string, id: number } };
101-
* type PersonNamePath = RelativeBindingPath<PersonWrapper, "/person">; // "name" | "id"
91+
* type PathRelativeToPerson = RelativeBindingPath<PersonWrapper, "/person">; // "name" | "id"
10292
*/
10393
export type RelativeBindingPath<
10494
Type,

0 commit comments

Comments
 (0)