Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

How to declare a statement in d.ts that has both an instance method and an instance attribute and has same name #233

Closed
freezestudio opened this issue Apr 9, 2016 · 3 comments

Comments

@freezestudio
Copy link
Contributor

e.g.

javascript class: Test

Instance Methods : var number=test.size();
Instance Variables : size Type: Number

in .d.ts How to declare it?

thanks!

or see:http://www.nodegit.org/api/diff_file/#size

@DanielRosenwasser
Copy link
Member

I think the documentation is mistaken. Each of those appears to be a function that returns those types. Can you try the API out and confirm? Perhaps @jvilk would be able to answer.

Additionally, make sure that you use primitives in place of their capitalized interface types. (i.e. use number instead of Number!) when writing your .d.ts files.

Lastly, it's no big deal, but in the future these sorts of questions are typically better asked on StackOverflow. 😃

@jvilk
Copy link

jvilk commented Apr 9, 2016

I have been summoned! @freezestudio, I am working with nodegit to generate TypeScript typings from its documentation. @DanielRosenwasser is correct: the documentation is incorrect. All of those "Instance Variables" are actually functions.

DiffFile looks like this in the typings.

Hope that helps!

@freezestudio
Copy link
Contributor Author

Thank you so much for your help.

@mhegazy mhegazy closed this as completed Apr 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants