runtime: better errors for implicit globals
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 23
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 17
Description
This code:
for (collection of collectGroupArray) { }
Produces an error like this:
R/T SyntaxError: The requested module '@openfn/language-mssql' does not provide an export named 'collection'
collection is an implicit global variable. The compiler generates an import statement, assuming that it will be provided by the adaptor.
But it is not provided by the adaptor! It's a global defined by the code!
The error we get is incomprehensible to users
What can we do?
- We could try to detect that
collectionis not a valid import and throw a clearer error earlier - We could detect SyntaxErrors of this form/pattern, and add some diagnostic information like "this can happen if you assign to a global variable)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example with for (collection of collectGroupArray) { } and trace how the compiler-generated import reaches the runtime. Compare the resulting SyntaxError with the intended implicit-global diagnostic; done means the failure is identified earlier or explained with actionable diagnostic information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100