typescript-vim icon indicating copy to clipboard operation
typescript-vim copied to clipboard

Syntax Highlighting breaks on parametrised lambda

Open merisbahti opened this issue 7 years ago • 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

merisbahti avatar Oct 24 '18 07:10 merisbahti

Thanks for the bug report!

leafgarland avatar Oct 31 '18 21:10 leafgarland

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!

OFRBG avatar Aug 11 '19 01:08 OFRBG