IntelliJ creates import statements which fail on runtime after (ts) transpile
See original GitHub issueWhen coding with IntelliJ which is fully typescript capable, when coding a line like this:
let message:GmailMessage = getCurrentMessage(event);
IntelliJ generates an import statement like this:
import GmailMessage = GoogleAppsScript.Gmail.GmailMessage;
This import statement becomes after transpiling and pushing:
var GmailMessage = GoogleAppsScript.Gmail.GmailMessage;
But this statement fails during script runtime. Problem is, without the import, I don’t have any autocomplete in my IDE and of course the IDE flags the source as invalid.
How to handle that situation? I simply can’t remove those lines manually in the Online Editor every time I have pushed. That would be a nightmare 😃
Expected Behavior
No runtime error.
Actual Behavior
ReferenceError: “GoogleAppsScript” is not defined. [line: 9, function: , file: src/GetContextualAddOn]
Steps to Reproduce the Problem
- use IDEA to code typed source code against Gmail AppsScript API
- push the results
Specifications
- latest IntelliJ IDEA on Mac
- Version (
clasp -v
): clasp 1.5.0 - OS (Mac/Linux/Windows): Mac
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Valid imports marked as errors, but correct import suggested ...
Hi, I've been working on a scala project on IntelliJ for a while. Recently, it started showing me import errors.
Read more >Auto import | IntelliJ IDEA Documentation - JetBrains
Basic procedures to create and optimize imports in IntelliJ IDEA. Learn more how to import the missing import or XML namespace.
Read more >Intellij IDEA cannot resolve any import statement
Hi there, I am struggling recently with very strange issue. Suddenly, my intellij IDEA stopped resolving all java import statements. The only ...
Read more >IDEA highlight import as red, even if compilation if fine and ...
As you can see IDEA highlights class ReconciliationSettings as error. Even if class is ok. It located in another maven module which is...
Read more >SyntaxError: Cannot use import statement outside a module ...
You're trying to execute a React program in Node.js, but it is designed to run in a web browser. There is no DOM...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can you try installing the latest version of clasp
1.5.1
, and see if the IntelliJ setup works?I will experiment with a solution that comments out the import line when pushing.
I created the 3rd party lib, so I can follow-up there.