Skip to content

Typescript error for builtins.ts #1963

Closed
@willemneal

Description

@willemneal

I'm in the process of updating visitor-as to use the newest version of the compiler. For some reason I get the following error:

../assemblyscript/src/builtins.ts:1544:9 - error TS2367: This condition will always return 'true' since the types 'BinaryOp' and '-1' have no overlap.

1544     if (op != -1) {
             ~~~~~~~~

../assemblyscript/src/builtins.ts:1623:9 - error TS2367: This condition will always return 'true' since the types 'BinaryOp' and '-1' have no overlap.

1623     if (op != -1) {
             ~~~~~~~~


Found 2 errors.

This is strange because the IDE will report this error, but when compiling tsc -p src there were no errors. Clearly the fix is to add as i32 to make tsc not mad, but I'm wondering if I'm missing something.

The weirdest part is that I was able to get visitor-as working by doing the same compile strategy as this repo. That is placing the tsconfig.json into the src directory and then compiling with tsc -p src.

I can't figure out why typescript behaves differently, but regardless should we considering fixing this if there are future projects that have a different setup?

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