Reports not properly written for Typescript

Stimulsoft Reports.JS discussion
Post Reply
martytheman
Posts: 7
Joined: Thu Nov 23, 2017 11:32 pm

Reports not properly written for Typescript

Post by martytheman » 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
HighAley
Posts: 8363
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Reports not properly written for Typescript

Post by HighAley » Thu Jun 25, 2020 3:31 pm

Hello.

Thank you for your questions.
We need some time for analysis and will keep in touch with any news.

Thank you.

Ticket reference: #2317
HighAley
Posts: 8363
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Reports not properly written for Typescript

Post by HighAley » Wed Jul 22, 2020 3:05 pm

Hello.

Here are answers from our developers:

1. The file is created by the compiler. Why do you think that this is wrong?
2. The issue with the types is fixed.
3. This task needs more time. It is in our TODO list.

Thank you.
martytheman
Posts: 7
Joined: Thu Nov 23, 2017 11:32 pm

Re: Reports not properly written for Typescript

Post by martytheman » Mon Sep 21, 2020 12:16 am

Hello.

So the problem is that non of your examples are in typescript.

I am forced to use:
var Stimulsoft = require('stimulsoft-reports-js');

When I should be able to use:
import Stimulsoft from 'stimulsoft-reports-js';

If I use the import - it should give me all the typings , and access to all the objects through intellisense AND it should help you find and bugs in your code ( which there appear to be 241 currently )

But it says:
/node_modules/stimulsoft-reports-js/Scripts/stimulsoft.reports.d.ts' is not a module.ts(2306)

Errors like the following show up and it is unusable with a proper import statement.

Errors like:
'text' is defined as a property in class 'BaseTree', but is overridden here in 'CommonTree' as an accessor.
HighAley
Posts: 8363
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Reports not properly written for Typescript

Post by HighAley » Thu Sep 24, 2020 8:33 am

Hello.

Unfortunately, it's impossible to import our scripts this way.
They are too large. Please, use the script tag to load the scripts.

Thank you.
Post Reply