Typescript Definitions Incomplete

I am trying to use typescript for DHTMLx 5.1 but finding that the definitions are incomplete.

TS2339: Property 'setText' does not exist on type 'dhtmlXCell'.

The dhtmlx.d.ts file doesn’t appear to contain the entry for setText, am I missing something or are the definitions incomplete?

The source shows that the setText is defined directly against dhtmlXLayoutCell

dhtmlXLayoutCell.prototype.setText = function(text) { this.conf.hdr.text = text; this._hdrUpdText(); };

The typescript file doesn’t appear to have a definition for dhtmlXLayoutCell and incorrectly declares dhtmlXCell as the return from dhtmlXLayoutObject.cells()

declare class dhtmlXLayoutObject { constructor(config:any); ... cells(id:string):dhtmlXCell; ... }

Ok so i’ve got my code compiling now after updating the typescript definition.

It’s a little worrying that I hit this on the first line of code using the DHTMLx typescript definition.

Is it ready to use?

[code]declare class dhtmlXLayoutObject {
constructor(config:any);
attachEvent(name:dhtmlXLayoutObjectEventName, handler:ICallable):number;
attachFooter(id:any, height:number):void;
attachHeader(id:any, height:number):void;
attachMenu(conf:any):dhtmlXMenuObject;
attachRibbon(conf:any):dhtmlXRibbon;
attachStatusBar(conf:any):{ [key: string]: any; };
attachToolbar(conf:any):dhtmlXToolbarObject;
cells(id:string):dhtmlXLayoutCell;
detachEvent(id:number):void;
detachFooter():void;
detachHeader():void;
detachMenu():void;
detachRibbon():void;
detachStatusBar():void;
detachToolbar():void;
dockWindow():void;
forEachItem(handler:ICallable):void;
getAttachedMenu():dhtmlXMenuObject;
getAttachedRibbon():dhtmlXRibbon;
getAttachedStatusBar():any;
getAttachedToolbar():dhtmlXToolbarObject;
getEffect():void;
getIdByIndex():void;
getIndexById():void;
hideMenu():void;
hidePanel():void;
hideRibbon():void;
hideStatusBar():void;
hideToolbar():void;
isPanelVisible():void;
listAutoSizes():void;
listPatterns():void;
listViews():void;
progressOff():void;
progressOn():void;
setAutoSize(hor:string, ver:string):void;
setCollapsedText():void;
setEffect():void;
setImagePath():void;
setOffsets(conf:any):void;
setSeparatorSize(index:number, size:number):void;
setSizes():void;
setSkin(skin:string):void;
showMenu():void;
showPanel():void;
showRibbon():void;
showStatusBar():void;
showToolbar():void;
unDockWindow():void;
unload():void;

dhxWins: dhtmlXWindows;
items: any[];

}

declare class dhtmlXLayoutCell extends dhtmlXCell {
constructor(config:any);
showHeader():void;
hideHeader():void;
isHeaderVisible():boolean;
showArrow():void;
hideArrow():void;
isArrowVisible():boolean;
setText(text:string):void;
getText():string;
setCollapsedText(text:string):void;
setCollapsedText():string;
expand():void;
collapse():void;
isCollapsed():boolean;
setMinWidth(min_width:number):void;
setMinHeight(min_height:number):void;
setWidth(width:number):void;
setHeight(height:number):void;
getWidth():number;
getHeight():number;
fixSize(width:boolean, height:boolean):void;

}[/code]

Maybe not, I’ve already hit another issue:

error TS2304: Cannot find name 'dhtmlxEvent'.

Unfortunately your problem cannot be reconstructed locally.
Could you please, provide with a simplified complete demo or share with a demo link, where the problem can be reproduced to check your sources files and initialization code.

Have you looked through the dhtmlx.d.ts file? you will find lots of places where it doesn’t follow the implementation.

For example the createWindow function is defined as having a void return value.

createWindow(id: string, x: number, y: number, width: number, height: number): void;

The online documentation is also incorrect as it states it should return the new windows handler but the definition is void.

docs.dhtmlx.com/api__dhtmlxwind … indow.html

It is as if someone has typed the typescript definitions from the documentation. I don’t think typescript is going to be at all usable unless the definitions are generated from the code.

Will you create a new top level dhtmlx/typescript forum board so issues can be raised there?

Thank you for your note.

The definition in the docs will be updated.
Also the dhtmlx.d.ts file will be updated in the near future so the createWindow will return the dhtmlXWindowCell object.

You may try to use the latest version from the attachment:
files.dhtmlx.com/30d/7cd74290aa … tmlx.d.zip

There are still lots of issues with the Typescript definitions for example missing a definition for dhtmlXGridCellObject entirely.

Will you create a new top level dhtmlx/typescript forum board so issues can be raised there?