Comments (5)
To do that, it would probably need to change the TypeScript compiler. Create another module system (as another option instead of "amd" or "commonjs").
I think you can call sap.ui.define by yourself, samething like this:
sap.ui.define(["sap/ui/core/mvc/Controller"], (Controller: typeof sap.ui.core.mvc.Controller) => Controller.extend("yournamespace.YourClass", {
onInit(): void {
this.yourMethod();
},
yourMethod(): void {
//your method body
}
}));
But this way, you would not get intellisense working for your own classes outside each one of them, unless you create definition .d.ts files for them.
Some people have talked about other solutions here:
SAP/openui5#88
I think it wouldn't be hard to create a Gulp plugin to convert AMD define calls (generated by TypeScript) into an UI5 sap.ui.define call.
from ui5ts.
Hi @lmcarreiro,
I was also thinking of moving to Typescript for some time to leverage our devs with UI5.
However the runtime requirement with your proposal is a no-go for me, as :
- we do not have access to the bootstrap application (index.html) and do not want to pollute the context for others (we are in the context of multiple apps in a launchpad env developed by multiple teams).
It is why for me making such changes must be done at compilation time. I will probably do a small POC with babel to move the generated Typescript to POUI5 (that's a funny name), but never played with it, so I probably won't be really good at it. If I make some progress I will provide it there.
Thanks for taking time to improve our lives with UI5 ;-)
from ui5ts.
@o0Djeen0o, @nathanss, Have you ever seen the Henry Li's babel plugin? https://github.com/MagicCube/babel-plugin-ui5
You could use TypeScript, target it to compile to ES2015 and use this plugin to convert your js code (generated by TypeScript compiler) to SAPUI5/OpenUI5 sap.ui.define calls.
In this case, you won't need my ui5ts npm package.
from ui5ts.
@lmcarreiro Thanks for this ts plugin. I just finished converting a couple UI5 apps to TS.
I have a fork of MagicCube's plugin which I can confirm work well with TypeScript and has a good set of features and options.
https://github.com/r-murphy/babel-plugin-transform-modules-ui5
from ui5ts.
Closing... This repository is being archived. Now the ui5ts package is maintained at https://github.com/neoprincie/ui5ts
from ui5ts.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui5ts.