google / clasp

đź”— Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.59k stars 428 forks source link

"Unattached" JSDoc Comments Removed on Push #897

Open Tbhesswebber opened 2 years ago

Tbhesswebber commented 2 years ago

Expected Behavior

When I have a JSDoc comment that doesn't have code immediately after it and run clasp push, the comment should be pushed to the GAS editor.

Actual Behavior

Running clasp push removes all JSDoc comments without code immediately after them.

Steps to Reproduce the Problem

Rather than steps, here's a real life example. Copy the local file and evaluate what gets pushed.

// local file

/**
 * @callback EventPredicate
 * @param {Calendar.CalendarEvent} event
 * @returns {boolean}
 */

/**
 * @callback EventPredicate
 * @param {Calendar.CalendarEvent} event
 * @returns {void}
 */

/**
 * @typedef {Object} EventTransformationMetaData
 * @property {string} eventType A string identifier so that you know why you made this object
 * @property {EventPredicate} predicate The predicate used to test against an event
 * @property {EventTransform} transform The transformation to run against the event when the predicate returns true
 */

/**
 * @type {Array<EventTransformationMetaData>}
 */
const eventTransforms: EventTransformationMetaData[] = [];

For me, the file in the GAS editor becomes the following:

/**
​* @type {Array<EventTransformationMetaData>}
​*/
var eventTransforms = [];

Specifications

PopGoesTheWza commented 2 years ago

This is likely a Typescript issue. See https://github.com/microsoft/TypeScript/issues/16727 if it relates to what you are experiencing.