leafgarland/typescript-vim

Syntax Highlighting breaks on parametrised lambda

merisbahti opened this issue · 2 comments

This code breaks the syntax highlighter:

type Stuff<T> = {
  result: T                    
} | {
  error: string
} 
const apply = <T>(x: T, y: T, f: (xx: T, xy: T) => Stuff<T>): Stuff<T> => {
    return f(x, y)             
} 
console.log(apply(5, 2, (x, y) => ({result: x + y})))

Seems to break after

const apply = <T>[...etc]

screenshot 2018-10-24 at 09 58 58

Thanks for the bug report!

OFRBG commented

Another case!

import t from 'io-ts';

export enum Entity {
  User,
  Client
}

const extendType = <T extends t.Props, K extends t.Props>(
  A: t.TypeC<T>,
  B: K
): t.TypeC<T & K> =>
  t.type({
    ...A.props,
    ...B
  });

const DBItem = t.type({
  id: t.string
});

Seems to break after T extends.

Bildschirmfoto 2019-08-10 um 20 22 00

Thanks for the plugin!