graph-tooling icon indicating copy to clipboard operation
graph-tooling copied to clipboard

Compiler hangs with invalid object return type and string interpolation

Open insprac opened this issue 3 years ago • 2 comments

When a function has a custom object type definition and it contains a string interpolation value the compiler hangs with no output.

To replicate:

export function example(): { id: string } {
  return { id: `` };
}

It doesn't matter what is inside of the string, as long as it contains the string definition with the back-ticks it'll hang.

The string definition doesn't need to be inside a variable definition or in the return statement, the following will still cause the issue:

export function example(): { id: string } {
  ``;
  return { id: "" };
}

When removing the back-ticks the compiler stops and outputs the error as expected:

ERROR TS1110: Type expected.

 export function example(): { id: string } {

 in tests/helpers/example...

insprac avatar Apr 07 '22 23:04 insprac

This doesn't appear to be an issue in newer versions of the AssemblyScript compiler, upgrading it will likely solve the issue

insprac avatar Apr 08 '22 20:04 insprac

I think this is fixed now in the latest versions of AssemblyScript and the @graphprotocol packages, so this issue can be closed?

PaulRBerg avatar May 18 '25 11:05 PaulRBerg