TypeScript and Qooxdoo

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

TypeScript and Qooxdoo

Peter Dekkers
In my search for a UI framework that would allow me to build a desktop like application, Qooxdoo seemed one of the most promising ones. However since my project (CATS, an IDE for TypeScript)) is written in TypeScript, I first wanted to make sure it could effectively be used from TypeScript. 

So I generated a declaration file for the Qooxdoo ui widgets and its dependencies (I did find one already on github but that was outdated and didn’t provide me the details I needed). I also tried to remove the dependencies on the generate tooling by including all the widgets already in the project. So you can use this project without having to install the Qooxdoo library or tooling.

Still a lot of things can be improved and I want to also evaluate a few things. But I already put this version on Github in case anyone wants to give it a try or find it remotely useful (there is a small demo app included that shows how it can be used). 

You can find it at: https://github.com/jbaron/qx-typed


Things still to be done:

1) Infer types based on the "var pattern” used by Qooxdoo. A lot of methods refer to a property that is typed. However the method itself is untyped (var) and right now mapped to any
2) Include typed events since TypeScript does support this nicely. 
3) Have some more test code, so I can easily see what still has to be manually changed to the qooxdoo.d.ts file for the test code to be compiled correctly. For example Qooxdoo doesn’t always correctly flag parameters as optional (or I am making some mistakes ;)

BTW also planning to put the generator on github that I used to generate this qooxdoo.d.ts file after I cleaned up some of the code. However also found out that there are many cases where the documentation (API) is not 100% correct and some small manual changes are required to make regular code pass TypeScript checks. Not sure if anyone is interested in this or not ?

— Peter

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: TypeScript and Qooxdoo

thron7
Wow, interesting.

Don't be offended when you don't get much feedback from core devs,
they're usually just too busy. The API issues are immediately
interesting, so post some examples for them when you find time, and
maybe open an issue with qooxdoo's bug tracker.

Post your project progress and your experiences once in a while.

T.


On Thu, Jul 3, 2014 at 7:09 PM, Peter Dekkers <[hidden email]> wrote:

> In my search for a UI framework that would allow me to build a desktop like
> application, Qooxdoo seemed one of the most promising ones. However since my
> project (CATS, an IDE for TypeScript)) is written in TypeScript, I first
> wanted to make sure it could effectively be used from TypeScript.
>
> So I generated a declaration file for the Qooxdoo ui widgets and its
> dependencies (I did find one already on github but that was outdated and
> didn’t provide me the details I needed). I also tried to remove the
> dependencies on the generate tooling by including all the widgets already in
> the project. So you can use this project without having to install the
> Qooxdoo library or tooling.
>
> Still a lot of things can be improved and I want to also evaluate a few
> things. But I already put this version on Github in case anyone wants to
> give it a try or find it remotely useful (there is a small demo app included
> that shows how it can be used).
>
> You can find it at: https://github.com/jbaron/qx-typed
>
>
> Things still to be done:
>
> 1) Infer types based on the "var pattern” used by Qooxdoo. A lot of methods
> refer to a property that is typed. However the method itself is untyped
> (var) and right now mapped to any
> 2) Include typed events since TypeScript does support this nicely.
> 3) Have some more test code, so I can easily see what still has to be
> manually changed to the qooxdoo.d.ts file for the test code to be compiled
> correctly. For example Qooxdoo doesn’t always correctly flag parameters as
> optional (or I am making some mistakes ;)
>
> BTW also planning to put the generator on github that I used to generate
> this qooxdoo.d.ts file after I cleaned up some of the code. However also
> found out that there are many cases where the documentation (API) is not
> 100% correct and some small manual changes are required to make regular code
> pass TypeScript checks. Not sure if anyone is interested in this or not ?
>
> — Peter
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: TypeScript and Qooxdoo

Peter Dekkers
Don’t worry, don’t get quickly offended :)

Most of the type of “errors" I got are in one of the following categories:

1) A class defines a method not compatible with one in the interface or base class. For example removeListener suddenly returns Element to allow for chaining instead of a boolean. I guess this is a balance between usability and OO correctness that sometimes doesn’t map well on TypeScript.

2) There are a lot of method parameters not defined optional while in fact they are. For example the icon parameter in many of the constructors. The declaration file still compiles well, but when I compile a project using these constructors I get many warnings about missing parameters.

3) Not always are the types mentioned in the doc fully qualified. Especially when a class name appears multiple times in different packages, this can be difficult to guess (at least for the parser).

And then there are some smaller things, like I have seen a return type being a package name instead of a class or interface. I’ll see if I can make an overview of the different findings.


BTW I did put the parser on Github right now for those who want to see it: https://github.com/jbaron/qx-parser


— Peter

On 07 Jul 2014, at 22:12, thron7 <[hidden email]> wrote:

> Wow, interesting.
>
> Don't be offended when you don't get much feedback from core devs,
> they're usually just too busy. The API issues are immediately
> interesting, so post some examples for them when you find time, and
> maybe open an issue with qooxdoo's bug tracker.
>
> Post your project progress and your experiences once in a while.
>
> T.
>
>
> On Thu, Jul 3, 2014 at 7:09 PM, Peter Dekkers <[hidden email]> wrote:
>> In my search for a UI framework that would allow me to build a desktop like
>> application, Qooxdoo seemed one of the most promising ones. However since my
>> project (CATS, an IDE for TypeScript)) is written in TypeScript, I first
>> wanted to make sure it could effectively be used from TypeScript.
>>
>> So I generated a declaration file for the Qooxdoo ui widgets and its
>> dependencies (I did find one already on github but that was outdated and
>> didn’t provide me the details I needed). I also tried to remove the
>> dependencies on the generate tooling by including all the widgets already in
>> the project. So you can use this project without having to install the
>> Qooxdoo library or tooling.
>>
>> Still a lot of things can be improved and I want to also evaluate a few
>> things. But I already put this version on Github in case anyone wants to
>> give it a try or find it remotely useful (there is a small demo app included
>> that shows how it can be used).
>>
>> You can find it at: https://github.com/jbaron/qx-typed
>>
>>
>> Things still to be done:
>>
>> 1) Infer types based on the "var pattern” used by Qooxdoo. A lot of methods
>> refer to a property that is typed. However the method itself is untyped
>> (var) and right now mapped to any
>> 2) Include typed events since TypeScript does support this nicely.
>> 3) Have some more test code, so I can easily see what still has to be
>> manually changed to the qooxdoo.d.ts file for the test code to be compiled
>> correctly. For example Qooxdoo doesn’t always correctly flag parameters as
>> optional (or I am making some mistakes ;)
>>
>> BTW also planning to put the generator on github that I used to generate
>> this qooxdoo.d.ts file after I cleaned up some of the code. However also
>> found out that there are many cases where the documentation (API) is not
>> 100% correct and some small manual changes are required to make regular code
>> pass TypeScript checks. Not sure if anyone is interested in this or not ?
>>
>> — Peter
>>
>> ------------------------------------------------------------------------------
>> Open source business process management suite built on Java and Eclipse
>> Turn processes into business applications with Bonita BPM Community Edition
>> Quickly connect people, data, and systems into organized workflows
>> Winner of BOSSIE, CODIE, OW2 and Gartner awards
>> http://p.sf.net/sfu/Bonitasoft
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: TypeScript and Qooxdoo

dfrost999
Nice work!
Typescript integration is certainly interesting and the principles used could serve useful for integration with other compile-to-js languages. Furthermore, the usage of a "monolithic" qx-lib is very interesting for certain use cases.
Could you elaborate how you generate ./script/base.js to keep it up to date with qooxdoo development?

Cheers,

Deacon
Reply | Threaded
Open this post in threaded view
|

Re: TypeScript and Qooxdoo

Peter Dekkers
The two pieces I did:

1) Base.js is the result of an qooxdoo application where I trick the Qooxdoo generate.py tool in thinking I use all of their desktop components. The qooxdoo tool then generates the base file for me. Very simple, but effective.

2) I also created a (small) application that parses the API docs of Qooxdoo (the JSON files in framework/api/script). With applying some logic I was able to generate a TypeScript declaration file that is at least valid TypeScript (if I recall correctly there were only a few cases where Qooxdoo violates some basic OO principles that needed manual fixing).  However there is still room for improvement. For example I don’t use the default value info in the API docs when generating the declaration file and for now also don’t use some type info that is available through the Qooxdoo property mechanism. So in TypeScript terms these  terms are of “any” type while in fact they could be properly typed.


So updating to a new version is not that hard. Just run the generate.py tool again and the parser, thats all. 


— Peter

On 19 Aug 2014, at 09:54, dfrost999 <[hidden email]> wrote:

Nice work!
Typescript integration is certainly interesting and the principles used
could serve useful for integration with other compile-to-js languages.
Furthermore, the usage of a "monolithic" qx-lib is very interesting for
certain use cases.
Could you elaborate how you generate ./script/base.js to keep it up to date
with qooxdoo development?

Cheers,

Deacon




--
View this message in context: http://qooxdoo.678.n2.nabble.com/TypeScript-and-Qooxdoo-tp7585949p7586076.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: TypeScript and Qooxdoo

tuebben
Hello Peter,

thanks for your great work!

Peter Dekkers wrote
1) Base.js is the result of an qooxdoo application where I trick the Qooxdoo generate.py tool in thinking I use all of their desktop components. The qooxdoo tool then generates the base file for me. Very simple, but effective.
Is it possible to publish this qooxdoo application, so we are able to generate the base.js by ourselves?

Thanks in advance & Greetings ... Peter (sorry for my bad english)
Sorry for my weird english