clasp icon indicating copy to clipboard operation
clasp copied to clipboard

'undefined' inside complied comment

Open fullth opened this issue 2 years ago • 4 comments

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

Replace something instead 'undefined'.

Actual Behavior

Commented at the top '// Compiled using undefined undefined (TypeScript 4.9.5)'

Steps to Reproduce the Problem

  1. I replaced file type 'Code.js' with 'Code.ts'
  2. clasp push

Specifications

  • Node version (node -v): v14.20.0
  • Version (clasp -v): v2.4.2
  • OS (Mac/Linux/Windows): Windows

fullth avatar Feb 03 '23 02:02 fullth

yes, in *.gs files see

// Compiled using undefined undefined (TypeScript 4.9.5)

tsconfig.json { "compilerOptions": { "lib": [ "esnext" ], "experimentalDecorators": true } }

node -v v21.2.0 clasp -v 2.4.2 OS: Mac Ventura

InExSu avatar Dec 29 '23 10:12 InExSu

Any progress? I started using clasp few days ago and after tutorial I see the same comment with undefined... Thanks in advance for any help!

UPDATE: Small progress :) The second undefined is related to version in package.json! My current comment: // Compiled using undefined 0.0.1 (TypeScript 4.9.5), so I suppose the first undefined will be related to other value from project settings.

pmaczko avatar Apr 09 '24 09:04 pmaczko

The comment originates from this line in ts2gas

https://github.com/grant/ts2gas/blob/535c850b0fd92203f885a8623f65caaa70887c51/src/index.ts#L374

I am unsure if either ts2gas or clasp need to be updated. I have stopped using Google Sheets and clasp a few years ago and no longer contribute these projects.

PopGoesTheWza avatar May 04 '24 15:05 PopGoesTheWza

So the undefined parts come from the package.json fields name and version, declaring them properly will return a "good" output

{
  "name": "my-project",
  "version": "1.0.0",
  "devDependencies": {
    "@types/google-apps-script": "^1.0.83"
  }
}

compiled file example output:

// Compiled using my-project 1.0.0 (TypeScript 4.9.5)
...

This might well be fixed documenting this behavior or prompting user for these values when creating or importing a project

ivancho1707 avatar Jun 28 '24 03:06 ivancho1707