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

[BUG] defining the type for the argument of a function #1031

Closed
weixiongmei opened this issue Oct 13, 2019 · 4 comments
Closed

[BUG] defining the type for the argument of a function #1031

weixiongmei opened this issue Oct 13, 2019 · 4 comments

Comments

@weixiongmei
Copy link

Reproduct Web: https://ternjs.net/doc/demo/index.html#simple

function ABC(cba: string)
{
  return cba;
}
ABC( //<- Expected the hint dialog to shows "ABC(cba: string) -> string". But in the demo, it's showing "ABC(cba, string)"
@marijnh
Copy link
Member

marijnh commented Oct 13, 2019

That's TypeScript (or Flow) syntax. Tern just parses JavaScript.

@marijnh marijnh closed this as completed Oct 13, 2019
@weixiongmei
Copy link
Author

is it possible to assign a type to the argument of the function like the ecmascript.json? So the hint can be clearer. Any workaround other than call it once? Thanks~~

@marijnh
Copy link
Member

marijnh commented Oct 13, 2019

You can use jsdoc comments — something like /** @param {String} cba */ above the function.

(With the doc_comments plugin enabled, that is.)

@weixiongmei
Copy link
Author

It works like a champ, thank you so much~~~

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

2 participants