google/clasp

Exported Google Sheets functions broke

mheffner opened this issue · 1 comments

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

Expected Behavior

I'm returning to a previous Google apps script I had built for Google sheets. I haven't worked on it for approximately a year, so it is likely something has changed in the tooling. When I try to build and rerun a test framework I had it is now complaining that it can't find a number of functions, the function names have an additional _1 suffix. I have split the app script out across several Typescript files to modularize the code. I'm looking for any assistance that could return the behavior to the version I had working in the clasp tooling previously.

My layout is similar to the following:

In foo.ts:

export function FOO() {
  ..do something..
}

This function FOO() was callable from a Google sheets cell as =FOO(..). In my test script in test.ts, I had something similar to:

import { FOO } from "../src/foo"

function test_foo() {
   FOO(...)
}

This test function was executed by a command clasp run runAllTests that invoked test_foo.

However, this now throws the error:

ReferenceError: "foo_1" is not defined

What is the correct way to export a function from one function that can be invoked from another file, while also exposing the function as a function in Google sheets?

Actual Behavior

FOO() can be invoked without errors.

Steps to Reproduce the Problem

See above

Specifications

  • Node version (node -v): v16.13.2
  • Version (clasp -v): 2.4.2
  • OS (Mac/Linux/Windows): Linux

This is for the project available here: https://github.com/mheffner/aws-pricing (repo issue: aryounce/aws-pricing#47)