-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-tooling-transpile): integrate ts-interface-generator
If a TypeScript project adds the dependency to the ts-interface-generator the ui5-tooling-transpile-middleware tries to start the watch mode so that changes to control files will automatically update the interfaces and that code completion can work properly. For now this only works for the local project, not for dependencies.
- Loading branch information
1 parent
ba5d734
commit 0f530b5
Showing
8 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ pnpm-lock.yaml | |
/**/*.svg | ||
/**/*.png | ||
/**/*.md | ||
/**/*.gen.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
showcases/ui5-tsapp-simple/webapp/control/SimpleControl.gen.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { PropertyBindingInfo } from "sap/ui/base/ManagedObject"; | ||
import { $ControlSettings } from "sap/ui/core/Control"; | ||
|
||
declare module "./SimpleControl" { | ||
|
||
/** | ||
* Interface defining the settings object used in constructor calls | ||
*/ | ||
interface $SimpleControlSettings extends $ControlSettings { | ||
text?: string | PropertyBindingInfo; | ||
} | ||
|
||
export default interface SimpleControl { | ||
|
||
// property: text | ||
|
||
/** | ||
* Gets current value of property "text". | ||
* | ||
* @returns Value of property "text" | ||
*/ | ||
getText(): string; | ||
|
||
/** | ||
* Sets a new value for property "text". | ||
* | ||
* When called with a value of "null" or "undefined", the default value of the property will be restored. | ||
* | ||
* @param text New value for property "text" | ||
* @returns Reference to "this" in order to allow method chaining | ||
*/ | ||
setText(text: string): this; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
showcases/ui5-tsapp-simple/webapp/control/SimpleControl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Control from "sap/ui/core/Control"; | ||
import RenderManager from "sap/ui/core/RenderManager"; | ||
import type { MetadataOptions } from "sap/ui/core/Element"; | ||
|
||
/** | ||
* @namespace ui5.ecosystem.demo.simpletsapp.control | ||
*/ | ||
export default class SimpleControl extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
}, | ||
}; | ||
|
||
// The following three lines were generated and should remain as-is to make TypeScript aware of the constructor signatures | ||
constructor(idOrSettings?: string | $SimpleControlSettings); | ||
constructor(id?: string, settings?: $SimpleControlSettings); | ||
constructor(id?: string, settings?: $SimpleControlSettings) { | ||
super(id, settings); | ||
} | ||
|
||
renderer = { | ||
apiVersion: 2, | ||
render: (rm: RenderManager, control: SimpleControl) => { | ||
rm.openStart("div", control); | ||
rm.style("font-size", "2rem"); | ||
rm.style("width", "2rem"); | ||
rm.style("height", "2rem"); | ||
rm.style("display", "inline-block"); | ||
rm.style("color", "blue"); | ||
rm.openEnd(); | ||
rm.text(control.getText()); | ||
rm.close("div"); | ||
}, | ||
}; | ||
} |