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:
https://www.typescriptlang.org/v2/en/play?ts=4.0.0-dev.20200505&useJavaScript=true#code/MYGwhgzhAEAa0G8CwAoa7oHoBU3UY22gGEwA7YAUxBgBcALS6AJ0oEcBXSiWgGmgiUyAEwCWZAObQw0YOSohwtUQHsy0Wio2NoKhpWbQADmGa0AnvgLQiAARPMwAW0QB5AEYArSsFoBfaANmFUMAfVCwDk1QiSEDMFpKYXCrAjsHZ0QeZnEJAH4AoJCAOlZINW0mIsMyiArNASFhStl5aiVVdQB3UQZUwmh7U0yEbNyCwOZg5mLgFWEmfUnp2XnFrUERFrkKdoTO6B6+tGs7VloOZjIYBAAFYKdRQWKAHmwAPgDWOpAAN25Dox1EtKP8yLRoPRINB3JQhI1wcV+uhsJhoP1IOYKK1diAABQIWoVAC80AARABVQSGBagcRJMn8OYLaCkslOYocalkgKkhB+ACUiD8qFQfiAA
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>;
}
Works in TS
3.9.0 betabut not innightly (4.0.0-dev.20200505)Code:
Playground:
https://www.typescriptlang.org/v2/en/play?ts=4.0.0-dev.20200505&useJavaScript=true#code/MYGwhgzhAEAa0G8CwAoa7oHoBU3UY22gGEwA7YAUxBgBcALS6AJ0oEcBXSiWgGmgiUyAEwCWZAObQw0YOSohwtUQHsy0Wio2NoKhpWbQADmGa0AnvgLQiAARPMwAW0QB5AEYArSsFoBfaANmFUMAfVCwDk1QiSEDMFpKYXCrAjsHZ0QeZnEJAH4AoJCAOlZINW0mIsMyiArNASFhStl5aiVVdQB3UQZUwmh7U0yEbNyCwOZg5mLgFWEmfUnp2XnFrUERFrkKdoTO6B6+tGs7VloOZjIYBAAFYKdRQWKAHmwAPgDWOpAAN25Dox1EtKP8yLRoPRINB3JQhI1wcV+uhsJhoP1IOYKK1diAABQIWoVAC80AARABVQSGBagcRJMn8OYLaCkslOYocalkgKkhB+ACUiD8qFQfiAA
Old output:
New output (invalid):