Reports not properly written for Typescript
Posted: Wed Jun 24, 2020 12:16 am
Hello.
When using your reports framework in typescript, the stimulsoft.reports.d.ts is not written correctly. Doing this should help you with your development as well as I instantly found a bug in your declaration that was easy to fix.
Maybe you should re-write it in typescript - you would pick up a lot of bugs much earlier in your development life cycle.
File 'node_modules/stimulsoft-reports-js/Scripts/stimulsoft.reports.d.ts' is not a module
I am not a typescript expert - so it would be good if you found the best practice for generating this - but here are some issues I found.
1) I can fix the error above if I do a global replace of
declare namespace
to
export namespace
2) once I have done #1 - VSCode shows me a bug in your declarations:
Property 'draw' in type 'StiMarkerCoreXF' is not assignable to the same property in base type 'IStiMarkerCoreXF'.
Type '(context: StiContext, marker: IStiMarker, position: Point, zoom: number, showShadow: boolean, isMouseOver: boolean, isTooltipMode: boolean, isAnimation: boolean, toolTip: string, tag: any, interaction: StiInteractionDataGeom) => void' is not assignable to type '(context: StiContext, marker: IStiMarker, position: Point, zoom: number, showShadow: boolean, isMouseOver: boolean, isTooltipMode: boolean, isAnimation: boolean, toolTip: String, tag: any, interaction: StiInteractionDataGeom) => any'.
Types of parameters 'toolTip' and 'toolTip' are incompatible.
Type 'String' is not assignable to type 'string'.
Simple to fix - in interface IStiMarkerCoreXF and the draw method ( line 18173 ) , I change toolTip: String to toolTip: string
3) The stimulsoft.reports.d.ts file is massive 2.7MB . It would be a good idea to break down the typesceript definition file into smaller files otherwise you are having to load the whole thing every time youload a report.
Thanks
Martin
When using your reports framework in typescript, the stimulsoft.reports.d.ts is not written correctly. Doing this should help you with your development as well as I instantly found a bug in your declaration that was easy to fix.
Maybe you should re-write it in typescript - you would pick up a lot of bugs much earlier in your development life cycle.
File 'node_modules/stimulsoft-reports-js/Scripts/stimulsoft.reports.d.ts' is not a module
I am not a typescript expert - so it would be good if you found the best practice for generating this - but here are some issues I found.
1) I can fix the error above if I do a global replace of
declare namespace
to
export namespace
2) once I have done #1 - VSCode shows me a bug in your declarations:
Property 'draw' in type 'StiMarkerCoreXF' is not assignable to the same property in base type 'IStiMarkerCoreXF'.
Type '(context: StiContext, marker: IStiMarker, position: Point, zoom: number, showShadow: boolean, isMouseOver: boolean, isTooltipMode: boolean, isAnimation: boolean, toolTip: string, tag: any, interaction: StiInteractionDataGeom) => void' is not assignable to type '(context: StiContext, marker: IStiMarker, position: Point, zoom: number, showShadow: boolean, isMouseOver: boolean, isTooltipMode: boolean, isAnimation: boolean, toolTip: String, tag: any, interaction: StiInteractionDataGeom) => any'.
Types of parameters 'toolTip' and 'toolTip' are incompatible.
Type 'String' is not assignable to type 'string'.
Simple to fix - in interface IStiMarkerCoreXF and the draw method ( line 18173 ) , I change toolTip: String to toolTip: string
3) The stimulsoft.reports.d.ts file is massive 2.7MB . It would be a good idea to break down the typesceript definition file into smaller files otherwise you are having to load the whole thing every time youload a report.
Thanks
Martin