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 publicly
typeName: PascalCase name of the type
returnType: 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;
What command(s) would you like to add?
lambda type declareDeclares 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 returnsparameterName,parameterType): Zero or more pairs of parameter names and typesSample usage
Why?
This is different from
lambda type inline(#588), which is more akin to declaring a type primitive likenull.Languages need a prettier way than
lambda type inlineto declare lambda types, especially when many methods take in the same lambda type.For example, in C#,
FormatIntwould be:...while in TypeScript,
FormatIntwould be: