_
_
_ _2016-04-27 12:20:13
typescript
_ _, 2016-04-27 12:20:13

How to declare a type by specifying a generic class and use it with new?

Suppose we have an Observable class that is generic, and I create instances through:
new Observable<number>();
And I want it like this:

type NumberStream = Observable<number>;
new NumberStream();

but it doesn't work like that, however, like:
class NumberStream extends Observable<number> {}
And in the first case the compiler swears, in the second it doesn't, but in both cases the compilation result is executed with an error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-04-27
@AMar4enko

Strange, apparently I had a bug somewhere
running

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question