Hello,
While trying to use the igDatePicker and trying to set options I keep getting errors.
$("#date-from").igDatePicker({ width: "250px", dateDisplayFormat: "dd/MM/yy", nullable: false, value: new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate())
});
TypeScript throws the following error:
Error TS2345 Argument of type '{ [x: number]: undefined; width: string; dateDisplayFormat: string; nullable: boolean; value: Dat...' is not assignable to parameter of type 'string'.
The only options that do seem to work are the not inherited ones (according to http://help.infragistics.com/jQuery/2014.2/ui.igdatepicker)
So I think the typings file (igniteui.d.ts) may be missing some options? Or am I doing something wrong?
I am using IgniteUI 20142.2477 and typescript 1.6.
Thank you!
Hello Michael,
In my tests with our samples this appears to be working fine in later releases. It appears for v15.2 support for TypeScript 1.5 was added:
http://www.igniteui.com/help/whats-new-in-2015-volume2
Thanks for the reply Mike P,
However this did not help me. Typescript is still complaining that it doesn't know certain properties:
I managed to solve this by adjusting your typings file (igniteui.d.ts) for the IgDatePicker.
Original:
interface IgDatePicker { focusOnDropDownOpen?: boolean; datepickerOptions?: any;}
Updated:
interface IgDatePicker { width?: string; dateDisplayFormat?: string; nullable?: boolean; value?: Date; button?: any; focusOnDropDownOpen?: boolean; datepickerOptions?: any;}
And now TypeScript is no longer complaining and everything works successfully (it did before, typescript was just throwing errors. If you ignored those it actually worked).
Maybe this could be fixed in a next release? Or has it already been fixed? I'm currently still on an older build (20142.2477) and unable to update.
Thank you
Thank you for the update and sample. I have done some looking into this matter. First I have been unable to run your sample as it won’t build. I did look at your code for the igDatePicker using type script and you appear to be missing a few things. It appears you are not referenceing all the proper scripts. I recommend you go over the following sample and documentation on how to use typescript with the Ignite UI controls:
http://www.igniteui.com/editors/typescript
http://www.igniteui.com/help/using-ignite-ui-with-typescript
I also noticed that you appear to both be using the MVC wrappers and typescript I would recommend you use on or the other. I would also recommend that you load the scripts required to use the igDatePicker without using the igLoader.
Hello Mike P,
My apologies for the inconvenience. I have attached the file below.
Thank you,
Thank you for the update. I am unable to download that file. The link just takes me to the main page for file dropper. Can you please instead attach that file to this case? You will have to delete the packages folder before attaching as well as the debug/release folders.