-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Suggestion: Allow typedefs for aliasing types, class names and interface names
Use case:
// 1. Use case overlaps with interface functions types and is even uglier
typedef (number) => number MyCallback;
// 2. With generics
typedef Vector<SomeDataType> MyVector;
// 3. With primitive data types
typedef string MyData;
// 4. Aliasing classes and interfaces
typedef ReallyLongClassName ShortName;
typedef otherModule.subModule.subModule.Runnable Runnable;
Question: Do we need them?
- Assigning a name to function types is already possible using interface function types. In my opinion, their syntax is nicer and we should not introduce another syntax for the same feature.
- This can help minimzing the amount of typing.
- According to the last comment of the original CodePlex issue, this can help commenting the code. It does however introduce another layer of name aliasing for names which are already short (
number, string, boolean
). - This can also help minimzing the amount of typing, especially for accessing external classes and interfaces inside deeply nested modules. Aliasing modules themselves would also be imaginable.
The original CodePlex issue: http://typescript.codeplex.com/workitem/119
Note that many of the given code examples are already covered by #14 (union types).
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript