jQWidgets Forums
jQuery UI Widgets › Forums › Getting Started › Typescript supported or not?
Tagged: typescript
This topic contains 6 replies, has 2 voices, and was last updated by Crisium 4 years, 4 months ago.
-
Author
-
I am a little confused. On the website it shows a Typescript Logo and I assume typescript is supported, but as I can see it is only angular that is supported (since the newest angular is typescript)…. but I do not see typescript only?
I need the d.ts files or the compiler complains.
what do I do?
I should probably add that I am using npm and I cannot see how to import or require modules?
Hi Crisium,
Of course Typescript is supported. We use it a lot for Angular & React development. To use it with Javascript, refer to https://www.jqwidgets.com/jquery-widgets-demo/demos/typescript/index.htm
Best regards,
Peter StoevjQWidgets Team
https://www.jqwidgets.com/Then I am doing something wrong, because I did follow those instructions even before you showed me the link.
>D:\Projects\testme5\app.ts(54,25): error TS2339: Build:Property ‘jqxDockingLayout’ does not exist on type ‘JQuery<HTMLElement>’.
and I do have the d.ts file reference on the top of the file:
/// <reference path=”node_modules/jqwidgets-scripts/jqwidgets-ts/jqwidgets.d.ts” />
so what do I do? I can force an <any> for the jquery part and it will compile and run perfectly, but then I have no typing.
peter
btw.. it would be cleaner if typing was done with the tsconfig instead of the brute force reference in the code.
peter
seems like this thread went dead.
I tried all combinations of jquery with jqwidgets and I cannot get past this error without having to resort to using <any>
>D:\Projects\testme5\app.ts(54,25): error TS2339: Build:Property ‘jqxDockingLayout’ does not exist on type ‘JQuery<HTMLElement>’.
I am compiling the typescript using develoeper studio set for a typescript project (meaning I am not using a commandline to compile the typescript nor do I wish to do that).
any suggestions how to move on?
SOLVED: finally I got it. I can see that the docs has a different way of creating the widgets then the examples.
I was doing:
(<any>$(‘#jqxDockingLayout’)).jqxDockingLayout({ width: “100%”, height: “100%”, layout: layout });
which does work, but didn’t want the <any>
The docs states to do this instead:
jqwidgets.createInstance(‘#jqxDockingLayout’, ‘jqxDockingLayout’, { width: “100%”, height: “100%”, layout: layout });
which also works and now I have the correct types.
doing this: /// <reference path=”node_modules/jqwidgets-scripts/jqwidgets-ts/jqwidgets.d.ts” />
is terrible!we should be using the tsconfig.json and add to the “types”: [“jqwidgets-scripts”] or something in that line.
anyone after two days of headaches this problem is now resolved.
-
AuthorPosts
You must be logged in to reply to this topic.