Skip to content

"yarn asbuild" failed on latest master #166

Open
@ashutoshvarma

Description

@ashutoshvarma

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions