Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript definitions for ExtJS 5

Is anyone working on TypeScript definitions for ExtJS 5? I keep checking DefinitelyTyped but there is no activity:

https://github.com/borisyankov/DefinitelyTyped/tree/master/extjs

like image 534
user826840 Avatar asked Jul 10 '14 08:07

user826840


People also ask

What is the use of ExtJS?

Ext JS is a popular JavaScript framework which provides rich UI for building web applications with cross-browser functionality. Ext JS is basically used for creating desktop applications. It supports all the modern browsers such as IE6+, FF, Chrome, Safari 6+, Opera 12+, etc.

Is ExtJS any good?

For being over a decade old, Ext JS is still a good platform to develop many enterprise-grade (think intranet) applications.

Is ExtJS outdated?

With a disappearing community, meager documentation, poor performance and significant licensing cost, ExtJS is quickly becoming a deprecated technology.

Is ExtJS a framework?

Ext JS is a JavaScript application framework for building interactive cross-platform web applications using techniques such as Ajax, DHTML and DOM scripting.


1 Answers

Maybe I answer after a time when the thing is no longer up-to-date, but I created
TypeScript definitions for Ext.JS 5, 6 and 7, because there were a lot of reasons
not to go by ways above:

  • Patched TypeScript compiller is no longer active. Today TypeScript version is far away from it.
  • Patched TS compiller is cool, but the TS compiller is too complicated project to maintain
    (for Ext.JS classes generating) for me.
  • The "Premium TypeScript definitions" on https://github.com/thanhptr/extts have
    a lot of mistakes and I mean a lot. For example the first call you need
    Ext.application({}); is nowhere.
  • JS Docs in github.com/thanhptr/extts contains HTML syntax, which is not so readable for day work.
  • Ext.JS TypeScript generator on github.com/zz9pa/extjsTypescript is too simple and not possible
    to use for higher Ext.JS versions (5, 6 and 7), but it was the main impulse to create
    new Ext.JS TypeScript definitions generator here.

My solution is based on the same principles like this blog post: "Using ExtJs with TypeScript".
But there are a few differences. I thing all differences could be clear from examples:

  • Example in Ext.JS 5.0.1
  • Example in Ext.JS 6.0.1 classic
  • Example in Ext.JS 6.2.0 classic
  • Example in Ext.JS 7.0.0 classic

The main differences are:

  • All classes are generated as they are.
  • All members from 'overrides' files are also generated.
  • Singleton classes like Ext, Ext.Array etc. are also generated properly.
  • Classes configurations are placed in *.Cfg interfaces, for example:
    Ext.panel.Panel has config interface in Ext.panel.Panel.Cfg.
  • To extend class, you need more than class config (you need object members like
    extend, requires, config, statics or maybe also template methods),
    so that's why there are also generated interfaces to have extended class definition:
    class extended from Ext.panel.Panel has interface for definition in Ext.panel.Panel.Def.
  • There are also generated self properties in better way.
  • There are generated interfaces for listeners/events, for example: Ext.panel.Panel has interface for events in Ext.panel.Panel.Events.
  • There are also generated a lot of interfaces for structured method params and more.

There is of course possible to create an application with modern toolkit, but Id didn't make any examples:-).

The solutions supports autocomplete everywhere and Visual Studio code refactoring by CTRL+R, which is very very practical:-)

like image 57
Tom Flídr Avatar answered Sep 20 '22 18:09

Tom Flídr