ForerunnerDB icon indicating copy to clipboard operation
ForerunnerDB copied to clipboard

[TypeScript] Array definitions incomplete (missing type)

Open no-more opened this issue 8 years ago • 4 comments

Hi,

Typescript generates lots of warning due to Arrays being untyped.

For example line 1818: private static _updateSplicePush(arr: Array, index: Number, doc: Object): void; should be something like : private static _updateSplicePush(arr: Array<any>, index: Number, doc: Object): void; in order to prevent those (many) warnings.

The exact error message is :

Generic type 'Array<T>' requires 1 type argument(s).

Thanks

no-more avatar Sep 20 '16 09:09 no-more

Is it possible to mark a library as not under typescript definition so that typescript will ignore it and not warn?

Maintaining a typescript definition file for this project is pretty difficult to do manually and the automatic generator doesn't appear to be working as well as we would like.

Irrelon avatar Sep 20 '16 09:09 Irrelon

I'll try to check if it's possible to do this.

What are you using to generate the definition file ? If it's an external tools maybe I could ask if they could upgrade their tools ?

no-more avatar Sep 20 '16 09:09 no-more

What are you using to generate the definition file ? If it's an external tools maybe I could ask if they could upgrade their tools ?

It's worth a go... the tool is: tsd-jsdoc (https://github.com/englercj/tsd-jsdoc)

Irrelon avatar Sep 20 '16 09:09 Irrelon

Hello, author of the tsd-jsdoc template here.

The issue is coming from things like this: https://github.com/Irrelon/ForerunnerDB/blob/1ec15deaaa43f51e834742839c8e8a27c7f58f3b/doc/Mixin.Updating.js.html#L64

Those annotations should include the array's element type. JSDoc accepts both Array.<type> and type[], and then the TS output will be valid.

I'm considering adding an option to assume any type for untyped things like this. But generally these TS errors imply that your docs are missing information, so I don't want the default to be pluging any into any holes.

englercj avatar Sep 20 '16 17:09 englercj