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

Overloads do not emit JSDoc on non-implementation signatures #27981

Open
bluelovers opened this issue Oct 19, 2018 · 3 comments
Open

Overloads do not emit JSDoc on non-implementation signatures #27981

bluelovers opened this issue Oct 19, 2018 · 3 comments
Labels
Domain: Comment Emit The issue relates to the emission of comments when compiling Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Milestone

Comments

@bluelovers
Copy link
Contributor

bluelovers commented Oct 19, 2018

TypeScript Version: 3.2.0-dev.201xxxxx

Search Terms:

Code

.ts file

/**
 * this will lost
 */
function a()
function a() { }

/**
 * this will keep
 */
function b() { }

function c()
/**
 * this will keep, but i don't think this is good way
 */
function c() { }

Expected behavior:

all will keep

/**
 * this will lost
 */
function a() { }
/**
 * this will keep
 */
function b() { }
/**
 * this will keep, but i don't think this is good way
 */
function c() { }

Actual behavior:

a is lost

output .js file

function a() { }
/**
 * this will keep
 */
function b() { }
/**
 * this will keep, but i don't think this is good way
 */
function c() { }

and when it at .d.ts

  • a will keep
  • b will keep too
  • but c will lost

Playground Link:
http://www.typescriptlang.org/play/index.html#src=%2F**%0D%0A%20*%20this%20will%20lost%0D%0A%20*%2F%0D%0Afunction%20a()%0D%0Afunction%20a()%20%7B%20%7D%0D%0A%0D%0A%2F**%0D%0A%20*%20this%20will%20keep%0D%0A%20*%2F%0D%0Afunction%20b()%20%7B%20%7D%0D%0A%0D%0Afunction%20c()%0D%0A%2F**%0D%0A%20*%20this%20will%20keep%2C%20but%20i%20don%27t%20think%20this%20is%20good%20way%0D%0A%20*%2F%0D%0Afunction%20c()%20%7B%20%7D

Related Issues:

@ghost ghost added Suggestion An idea for TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling labels Oct 19, 2018
@RyanCavanaugh RyanCavanaugh added the Experience Enhancement Noncontroversial enhancements label Oct 19, 2018
@RyanCavanaugh
Copy link
Member

@sandersn How do you feel about emitting all JS doc comments attached to the first signature + the implementation signature, eliding all intermediates? That should eliminate duplicates without breaking existing emit too badly.

@sandersn
Copy link
Member

@bterlson probably has opinions since he was thinking about how to write jsdoc for overloads.

@sandersn sandersn changed the title compile output bug with jsdoc Overloads do not emit JSDoc on non-implementation signatures Oct 19, 2018
@weswigham weswigham removed the Suggestion An idea for TypeScript label Nov 6, 2018
@RyanCavanaugh RyanCavanaugh added the Suggestion An idea for TypeScript label Mar 7, 2019
@bluelovers
Copy link
Contributor Author

Expected behavior:

ts

/**
 * this will keep, because all other overloads didn't have jsdoc
 */
function a()
function a()
function a() { }


function b()
function b()
/**
 * this will keep, because all other overloads didn't have jsdoc
 */
function b() { }

/**
 * desc
 */
function c()
function c()
/**
 * this will lost, because one of overloads have jsdoc
 */
function c() { }

=>

/**
 * this will keep, because all other overloads didn't have jsdoc
 */
declare function a(): any;
/**
 * this will keep, because all other overloads didn't have jsdoc
 */
declare function a(): any;
/**
 * this will keep, because all other overloads didn't have jsdoc
 */
declare function b(): any;
/**
 * this will keep, because all other overloads didn't have jsdoc
 */
declare function b(): any;
/**
 * desc
 */
declare function c(): any;
declare function c(): any;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Comment Emit The issue relates to the emission of comments when compiling Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants