Skip to content

Conversation

@geopic
Copy link
Contributor

@geopic geopic commented Mar 18, 2020

Resolves #1. Let me know if there are any issues.

@yumetodo
Copy link
Contributor

yumetodo commented Mar 18, 2020

In .d.ts file, is it really required to use the jsdoc syntax to specify argument type? I think this is verbose.

@geopic
Copy link
Contributor Author

geopic commented Mar 18, 2020

I copied index.js and worked from it. If you want I can remove the argument and return type statements from the jsdoc blocks so only the description of each function is left?

@yumetodo
Copy link
Contributor

I think removing is better to keep type file simple. But I want to wait maintener's comment about this.

Copy link
Member

@wolfram77 wolfram77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to specify type for:

  • compare function
  • map function

all in one pace and reuse it everywhere?

@wolfram77
Copy link
Member

If we remove the @param and @return, it wouldnt show the comments for each parameter. Is there a way to just remove all the jsdoc so that editor directly refers to that in index.js?

I also have made a few mistakes in the jsdoc, and have a few new methods in mind:

@yumetodo
Copy link
Contributor

I'm proposing to remove only type information in jsdoc comment. Because there is typescript base type information.

ex.)

  /**
   * Binary searches leftmost value in sorted array.
   * @param x an array (sorted)
   * @param v search value
   * @param fn compare function (a, b)
   * @returns first index of value | ~(index of closest value)
   */
   export function bsearch<T>(x: T[], v: T, fn?: (a: T, b: T) => number): number;

@wolfram77
Copy link
Member

That is indeed better than having additional type information. Good suggestion.

@geopic geopic requested a review from wolfram77 March 19, 2020 18:08
@geopic
Copy link
Contributor Author

geopic commented Mar 19, 2020

@wolfram77 I've made two commits, one with no alteration to the jsdoc blocks and the other which removes the type statements as @yumetodo showed in an example. Let me know if there are any further issues.

@yumetodo
Copy link
Contributor

LGTM!

image
image

@wolfram77 wolfram77 merged commit 2c47985 into nodef:master Mar 20, 2020
@wolfram77
Copy link
Member

@geopic Indeed type information looks much simpler now. This was indeed a much bigger effort than the other one. I have a few more ideas which i will put together on the todo list. I learnt a bit of typescript declaration from both of you. Thanks.

Copy link
Member

@wolfram77 wolfram77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like test function can be merged too.

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

Successfully merging this pull request may close these issues.

TypeScript type declaration file

3 participants