Skip to content
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

"yarn asbuild" failed on latest master #166

Open
ashutoshvarma opened this issue Mar 17, 2021 · 4 comments
Open

"yarn asbuild" failed on latest master #166

ashutoshvarma opened this issue Mar 17, 2021 · 4 comments

Comments

@ashutoshvarma
Copy link
Contributor

Summary

While trying to compile from latest master branch kept getting ERROR TS2304: Cannot find name 'null'.


Steps to reproduce

  • git clone https://github.com/nearprotocol/assemblyscript-json
    cd assemblyscript-json
    yarn
    
  • yarn asbuild

Actual Behaviour

yarn run v1.22.5
$ yarn asbuild:untouched && yarn asbuild:optimized
$ asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --validate --debug
WARNING Unknown option '--validate'
ERROR TS2304: Cannot find name 'null'.

   valueOf(): null {
              ~~~~
 in assembly/JSON.ts(252,14)

WARNING AS232: Exported generic function or class has no concrete instances.

     set<T>(key: string, value: T): void {
     ~~~
 in assembly/JSON.ts(358,5)

WARNING AS232: Exported generic function or class has no concrete instances.

 export function from<T>(val: T): Value {
                 ~~~~
 in assembly/JSON.ts(446,17)

WARNING AS232: Exported generic function or class has no concrete instances.

 export function parse<T = Uint8Array>(str: T): Value {
                 ~~~~~
 in assembly/JSON.ts(479,17)

WARNING AS232: Exported generic function or class has no concrete instances.

 export class JSONDecoder<JSONHandlerT extends JSONHandler> {
              ~~~~~~~~~~~
 in assembly/decoder.ts(118,14)

FAILURE 1 compile error(s)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected Behviour
Compile to wasm without error

Machine Info

  • node v14.15.0
  • assemblyscript@0.15.2

Potential Fix

https://github.com/nearprotocol/assemblyscript-json/blob/ee138a5557a6ca63a7e3143c462f542029857ecc/assembly/JSON.ts#L252

After replacing with below, I was able to compile successfully.

valueOf(): Null | null {
ashutoshvarma added a commit to ashutoshvarma/assemblyscript-json that referenced this issue Mar 17, 2021
@ashutoshvarma ashutoshvarma changed the title Build Failed - "yarn asbuild" on latest master "yarn asbuild" failed on latest master Mar 17, 2021
@willemneal
Copy link
Contributor

This seems to be a bigger issue with AS and I posted it here: AssemblyScript/assemblyscript#1744

@ashutoshvarma
Copy link
Contributor Author

ashutoshvarma commented Mar 18, 2021

Ok, I see
Should I close the PR now?

How should it be tackle then, cause #168 needs to build the wasm from the latest source. Without the workaround of Null | null it won't be able to build.

@willemneal
Copy link
Contributor

Looking into it more, this is a library so it doesn't make much sense to build from the index file. Seeing as we haven't see this error downstream I'm, I think you could just revert that commit in your #168. I just tested it locally and it will build the binary you added without the change.

ashutoshvarma added a commit to ashutoshvarma/assemblyscript-json that referenced this issue Mar 18, 2021
@ashutoshvarma
Copy link
Contributor Author

Yeah, you are right
Just built the helper module without 13f3460 sucessfully

During initial testing I tried building as-json from the index.ts, so looks like it came from there.

I have reverted the 13f3460 from #168 and closed the #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants