-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export declarations are not exposed as triggers to GAS #2
Comments
Hi, what error are you seeing when you run the code? Could you create a public GitHub repository with your typescript code so I can try it out? |
Hi thanks for getting back to me. I created a repo with my code here: https://github.com/kiddhustle/gas-ts-template There is no error per say, but whilst I do see the code pushed to my project (via clasp), I am unable to execute the code. I am not sure if this is because the code in the example is made up of triggers. I created another function |
Please note that I am unable to select and run a function. |
Thanks @kiddhustle; I'm able to reproduce this as well. It seems to be a bug in the Webpack plugin we are using to build the Simple declaration exports do not work: // ❌ Does NOT work
export function one() { /* ... */ }
export const two = () => { /* ... */ } But object exports and re-exports from other files do: // ✅ Does work:
function three() { /* ... */ }
export {three}
export {four} from "./four.ts" So as a workaround, you can update your code like so: function onOpen(
e:
| GoogleAppsScript.Events.DocsOnOpen
| GoogleAppsScript.Events.SlidesOnOpen
| GoogleAppsScript.Events.SheetsOnOpen
| GoogleAppsScript.Events.FormsOnOpen,
): void {
console.log(e);
}
function onEdit(e: GoogleAppsScript.Events.SheetsOnEdit): void {
console.log(e);
}
function onInstall(e: GoogleAppsScript.Events.AddonOnInstall): void {
console.log(e);
}
function doGet(e: GoogleAppsScript.Events.DoGet): void {
console.log(e);
}
function doPost(e: GoogleAppsScript.Events.DoPost): void {
console.log(e);
}
export {onOpen, onEdit, onInstall, doGet, doPost} I recognize this is not as readable but unfortunately I think it's the only solution until the bug gets fixed. I will update the example code and documentation to note this. |
OK thanks for looking into this for me. At least now I know the problem is not with the project or the code. Thanks! |
No problem, thanks for reporting the bug! |
I create an app with simple code however I cannot execute any of the transpiled code in the script editor.
Is this down to the project code or setup/configuration?
The text was updated successfully, but these errors were encountered: