Repository navigation
Regression: DTS emit #38356
Copy link
Copy link
Closed
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyDomain: LS: Type DisplayBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Milestone
Description
Works in TS 3.9.0 beta but not in nightly (4.0.0-dev.20200505)
Code:
class X {
/**
* Cancels the request, sending a cancellation to the other party
* @param {Object} error __auto_generated__
* @param {string?} error.reason the error reason to send the cancellation with
* @param {string?} error.code the error code to send the cancellation with
* @returns {Promise.<*>} resolves when the event has been sent.
*/
async cancel({reason = "User declined", code = "m.user"} = {}) {}
}Playground:
Old output:
declare class X {
/**
* Cancels the request, sending a cancellation to the other party
* @param {Object} error __auto_generated__
* @param {string?} error.reason the error reason to send the cancellation with
* @param {string?} error.code the error code to send the cancellation with
* @returns {Promise.<*>} resolves when the event has been sent.
*/
cancel({ reason, code }?: {
reason: string;
code: string;
}): Promise<any>;
}New output (invalid):
declare class X {
/**
* Cancels the request, sending a cancellation to the other party
* @param {Object} error __auto_generated__
* @param {string?} error.reason the error reason to send the cancellation with
* @param {string?} error.code the error code to send the cancellation with
* @returns {Promise.<*>} resolves when the event has been sent.
*/
cancel({ reason, code }?:
* @param {?string} error.reason the error reason to send the cancellation with
* @param {?string} error.code the error code to send the cancellation with
): Promise<any>;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyDomain: LS: Type DisplayBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoBugs relating to showing types in Quick Info/Tooltips, Signature Help, or Completion InfoNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Activity
Jack-Works commentedon May 6, 2020
Another problem:
In 3.9.0 beta:
In nightly:
Notice the missing generics make it invalid
DanielRosenwasser commentedon May 6, 2020
Wesley Wigham (@weswigham) this is a 3.9 regression - I think it'd be best to just never reuse type nodes if they come from a JS file.
weswigham commentedon May 6, 2020
Daniel Rosenwasser (@DanielRosenwasser) too late - #38368 has the fix. We have code explicitly mapping jsdoc constructs to ts type constructs, it was just missing the jsdoc object literal form, and didn't account for how we allow missing type parameters (even without defaults) in JS.
DanielRosenwasser commentedon May 6, 2020
My fear is just that there's another case we haven't covered. The assumption is that TS types are always "well formed" for declaration emit, but JS nodes aren't. As long as we're confident that there aren't other cases that we've missed, #38368 should be sufficient.
weswigham commentedon May 6, 2020
As we add support for more jsdoc forms, we should check that we actually support declaration emit for those forms, same as we do for TS type nodes. If we could exhaustively check for node kinds so it's typesystem enforced, I would, but, ah, something something, compiler performance compiling itself is still kinda bad when
Nodeis a union of all possible kinds?