bloomberg/ts-blank-space

async arrow function with multiple line generic

Closed this issue · 0 comments

Describe the bug

@seralexeev has discovered an edge case that is not being handled correctly (#18).

The issue occurs for async arrow functions when the type parameters span multiple lines.

To Reproduce

Steps to reproduce the behavior:

const fn = async <
    T,
    U,
    V
>() => null;

Expected behavior

As the input is valid TypeScript. ts-blank-space should either mark this as an error (via on onError callback), or it should produce valid JavaScript with the same semantics.

Actual behavior

const fn = async  
      
      
     
 () => null;

And no errors.

As per the ecma262 AsyncArrowHead spec the async keyword cannot be followed by a line terminator.

Playground

https://bloomberg.github.io/ts-blank-space/play/#eyJ0c3giOmZhbHNlLCJ0ZXh0IjoiY29uc3QgZm4gPSBhc3luYyA8XG4gICAgVCxcbiAgICBVLFxuICAgIFZcbj4oKSA9PiBudWxsOyJ9