Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Array definitions incomplete (missing type) #154

Open
no-more opened this issue Sep 20, 2016 · 4 comments
Open

[TypeScript] Array definitions incomplete (missing type) #154

no-more opened this issue Sep 20, 2016 · 4 comments

Comments

@no-more
Copy link

no-more commented Sep 20, 2016

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' requires 1 type argument(s).

Thanks

@Irrelon
Copy link
Owner

Irrelon commented Sep 20, 2016

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.

@no-more
Copy link
Author

no-more commented Sep 20, 2016

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 ?

@Irrelon
Copy link
Owner

Irrelon commented Sep 20, 2016

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)

@englercj
Copy link

englercj commented Sep 20, 2016

Hello, author of the tsd-jsdoc template here.

The issue is coming from things like this:

* @param {Array} arr The array to modify.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants