TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Generic Type Alias

Open mudHOAX opened this issue 11 years ago • 2 comments

I'd love to have the ability to be able to create generic type aliases.

At the moment we are using interfaces to reference our common function signatures.

interface IGenericCallback<T> {
    <T>(val: T, index: number, arr: Array<T>): void;
}

I'd love to be able to remove these interfaces and use something along the lines of:

type GenericCallback<T> = <T>(val: T, index: number: arr: Array<T>): void;

Is this something that may be considered as a feature enhancement?

Regards, Ian Munro

mudHOAX avatar Feb 12 '15 08:02 mudHOAX

:+1:

donnut avatar Feb 12 '15 08:02 donnut

See #1616.

danielearwicker avatar Feb 12 '15 16:02 danielearwicker