Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Types: Allow for defining variant signatures. #1299

Closed
electricessence opened this issue Nov 28, 2014 · 4 comments
Closed

Generic Types: Allow for defining variant signatures. #1299

electricessence opened this issue Nov 28, 2014 · 4 comments
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript

Comments

@electricessence
Copy link

Currently if I define:

interface Func<TResult> {
  ():TResult;
}

I then cannot have any varying generic definitions.
i.e.

interface Func<TParam,TResult> {
  (value:TParam):TResult;
}

Another important ability of C# that is missing is:

interface Action<TParam> {
  (value:TParam):void;
}

But then also have a default non-generic version.
i.e.

interface Action {
  ():void;
}

Or:

interface IEnumerable<T> {
  getEnumerator():IEnumerator<T>
}

But then also have a default non-generic version.
i.e.

interface IEnumerable {
  getEnumerator():IEnumerator
}

I may have missed this topic/issue in the search, so I apologize ahead of time that I was unable to find it.
I'm also still using 1.0.1 version of TypeScript.

@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Dec 1, 2014
@RyanCavanaugh
Copy link
Member

Specifying the type of a generic argument used to be optional, but we could think about revisiting this now that type arguments are mandatory.

@danquirk
Copy link
Member

danquirk commented Dec 1, 2014

I think #209 covers this.

@danquirk danquirk closed this as completed Dec 1, 2014
@danquirk danquirk added Duplicate An existing issue was already created and removed In Discussion Not yet reached consensus labels Dec 1, 2014
@electricessence
Copy link
Author

@danquirk, I see the last comment mentions what I'm talking about, but I missed where the decision was made or the solution existed?
Is it possible today to do this? Or will it be in the future?

@RyanCavanaugh
Copy link
Member

#209 is still under consideration. We haven't decided not to do it, but we haven't committed to doing it either.

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants