-
Notifications
You must be signed in to change notification settings - Fork 17
Add a LambdaTypeDeclare command #587
Copy link
Copy link
Open
Description
What command(s) would you like to add?
lambda type declare
Declares a type for a lambda that can be passed around similar to an interface.
Parameters
export(optional): keyword to expose the lambda type declaration publiclytypeName: PascalCase name of the typereturnType: What type the lambda returns- (
parameterName,parameterType): Zero or more pairs of parameter names and types
Sample usage
lambda type declare : export FormatInt string value int
Why?
This is different from lambda type inline (#588), which is more akin to declaring a type primitive like null.
Languages need a prettier way than lambda type inline to declare lambda types, especially when many methods take in the same lambda type.
For example, in C#, FormatInt would be:
public delegate string FormatInt(int value);...while in TypeScript, FormatInt would be:
type FormatInt = (value: number) => string;Reactions are currently unavailable