easegress-io / easegress-assemblyscript-sdk Goto Github PK
View Code? Open in Web Editor NEWAssemblyScript SDK for Easegress
License: Apache License 2.0
AssemblyScript SDK for Easegress
License: Apache License 2.0
Describe the bug
Hi there, I got an error when executing the npm run asbuild
command in Flash Sale demo.
Here's the error detail:
$ npm run asbuild
> [email protected] asbuild
> npm run asbuild:debug && npm run asbuild:release
> [email protected] asbuild:debug
> asc assembly/index.ts --target debug --use abort=
ERROR AS238: Initializer, definitive assignment or nullable type expected.
:
34 │ var programFactory: (params: Map<string, string>)=>Program
│ ~~~~~~~~~~~~~~
└─ in ../../easegress-assemblyscript-sdk/easegress/index.ts(34,5)
ERROR AS238: Initializer, definitive assignment or nullable type expected.
:
35 │ var program: Program
│ ~~~~~~~
└─ in ../../easegress-assemblyscript-sdk/easegress/proxy.ts(35,5)
FAILURE 2 compile error(s)
Version
Additional context
I did some research about ERROR AS238
but got nothing useful.
According to the error message, here's what I tried:
diff --git a/easegress/index.ts b/easegress/index.ts
-var programFactory: (params: Map<string, string>)=>Program
+type ProgramFactory = (params: Map<string, string>)=>Program
+var programFactory: ProgramFactory = (params)=>new Program(params)
diff --git a/easegress/proxy.ts b/easegress/proxy.ts
-var program: Program
+var program = new Program(new Map<string, string>())
After rebuild, then it worked. And on assemblyscript's 0.19.7 version, it also worked fine.
But I'm new to TypeScript, so I'm not sure if it is the best resolution. Need you guy's help. 🤯
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.