ForerunnerDB
ForerunnerDB copied to clipboard
[TypeScript] Array definitions incomplete (missing type)
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
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.
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 ?
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)
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.