import { confirm } from 'devextreme/ui/dialog'; to a component
use confirm
confirm('My string', '').done(res => {
if (res === true) {
location.reload();
}
});
Gets compile error:
error TS2339: Property 'done' does not exist on type 'JQueryPromise<boolean>'.
Find another way to get dialogs working again 馃
Chrome latest, Win 10, angular 5.0.0-rc.9
"devextreme": "17.2.1-pre-17291",
"devextreme-angular": "17.2.1-beta.3",
Yes, I've managed to reproduce this behavior in a project made using Angular CLI. At the moment, remove the "types": [] line from the src\tsconfig.app.json file to avoid it. But, I can confirm that this step is not needed with version 17.1 of our devextreme package. We will research this issue. The project that reproduces it is attached.
GH1784.zip
Thank you for your patience. To resolve the issue, upgrade the devextreme package to version 17.2.1-pre-17296 or later. Then, now, you need to use the then event instead of done.
confirm('My string', '').then(res => {
if (res === true) {
location.reload();
}
});
That worked @GoshaFighten 馃帀 thanks!
I've upgraded to 17.2.3 and I'm still getting this error. I'm using devextreme and devextreme-angular 17.2.3, and the errors I'm seeing are the following:
ERROR <path-to-component> (131,14): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
ERROR in <path-to-component> (116,12): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
ERROR in <path-to-component> (247,12): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
ERROR in <path-to-component> (114,45): Operator '===' cannot be applied to types 'Element | JQuery' and 'string'.
ERROR in <path-to-component> (131,14): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
ERROR in <path-to-component> (116,12): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
ERROR in <path-to-component> (114,45): Operator '===' cannot be applied to types 'Element | JQuery' and 'string'.
ERROR in <path-to-component> (247,12): Property 'then' does not exist on type 'JQueryPromise<boolean>'.
I was able to get rid of these errors by not using the JqueryPromise<boolean> type and just moving straight to a Promise<boolean> type. But then I errors with tooltips.
It looks like the interfaces for the typings changed or something because things that worked are no longer transpiling successfully in an Angular-CLI application. The tooltip target input in the examples here: https://js.devexpress.com/Demos/WidgetsGallery/Demo/Tooltip/Overview/Angular/Light/ still show setting the target of the tooltip to the id of an element in the dom. But when I try bind a method to the mouse events for hovering over these elements like this:
toggleCardTooltip(event, projectId, visible) {
console.log(event.target.id);
console.log(this.tooltips.map(t => t.target));
const element = this.tooltips.find(t => t.target === `#${event.target.id}`);
if (element) {
element.visible = visible;
}
}
I get the following error: Operator '===' cannot be applied to types 'Element | JQuery' and 'string'. When I look at the type of target on a DxTooltipComponent, it is indeed an Element | JQuery in the typings. But if I log out what the targets actually are, they are still strings with the ids in there.
If I cast t.target to any like this:
const element = this.tooltips.find(t => (<any>t.target) === `#${event.target.id}`);
then I get functionality back, but it kind of defeats the purpose of using typescript, no?
Most helpful comment
Thank you for your patience. To resolve the issue, upgrade the
devextremepackage to version17.2.1-pre-17296or later. Then, now, you need to use thethenevent instead ofdone.