ts2gas | A function that transpiles TypeScript to Google Apps Script
kandi X-RAY | ts2gas Summary
kandi X-RAY | ts2gas Summary
A function that transpiles TypeScript to Google Apps Script.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ts2gas
ts2gas Key Features
ts2gas Examples and Code Snippets
Community Discussions
Trending Discussions on ts2gas
QUESTION
I have a Mac running macOS 11.4. I've used clasp (extensively) on this same machine with same OS but recently I had to wipe my SSD and reinstall everything.
I've installed node.js using the macOS installer (node-v14.17.3.pkg), this includes npm.
Then I've installed clasp via Terminal with sudo npm install @google/clasp -g
.
The above process mirrors what I did when I installed first time round, although they would have been earlier versions (maybe a year ago).
Now when I try to run clasp (with or without options) I get an error, I'm hoping someone can help diagnose?
...ANSWER
Answered 2021-Jul-18 at 20:30I had the exact same issue. I downgraded to clasp version 2.3
QUESTION
How to Dynamically Update a Sheets Custom Menu with Typescript
I have implemented the following: Dynamically Updating Custom Menu of Google Spreadsheet using Google Apps Script a sample script for dynamically updating the custom menu of Google Spreadsheet using Google Apps Script.
but in Typescript there is an exception when clicking the menu item: Script function not found: Col1
Is there something else that is required with typescript?
Main.ts
...ANSWER
Answered 2021-Jun-18 at 07:29- I thought that in your script, when the menu of
Col1
is run, the function is not created. - Also, I thought that the reason of your issue is due to
this[dynamicMenu] = dynamicItem(i);
.- I think that in your situation,
this
in the function cannot be used for installing the functions.
- I think that in your situation,
By above situation, the error of Script function not found: Col1
occurs. So, in order to avoid this issue for your current script, how about the following modification?
In this answer, I modified your script as follows.
Main.ts
:
QUESTION
Suppose we have 2 simple TypeScript classes in 2 separate files:
- B.ts:
ANSWER
Answered 2020-Jan-20 at 19:11One of the root cause of your issue is the Rhino v1.7R3 JavaScript engine which runs Apps Script and the way the many .gs
files making up one script are hoisted.
Also the way ts2gas
library works, by transpiling each source file independently, has some limitations and may play a minor role in your issue.
To summarise, your script is effectively the concatenation of all your .gs
files, in the order they were appear in the Google Apps Script editor. This order is usually the order each .gs
was created. When using @google/clasp
to push your local files to your script project, this order is likely to change to the alphabetical order of your source filenames.
In your example, the .gs
declaring the parent class must appear before any declaration of children classes (i.e. the hoisting issue)
To ensure proper ordering of your code and avoid this, you have several options:
- regroup code with potential hoisting issue in a single file (clumsy and messy in the long run)
- use the
filepushorder
option in your.clasp.json
to specify which files should be pushed first. (easy to setup and maintain) - have a different project build chain for finer control of Typescript compilation and precise file order (if necessary.) Here is the template repository I have setup to get started.
EDIT
To illustrate usage of the filePushOrder
option, I have setup a sample repository with your sample code.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ts2gas
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page