Covariance / Contravariance for generics?
See original GitHub issueSeems it doesn’t support in hegel?
class Base {}
class Foo extends Base {}
const fooArr: Array<Foo> = [new Foo()];
const baseArr: Array<Base> = fooArr;
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Understanding Covariance and Contravariance of Generic ...
In this article, we will examine what covariant and contravariant generic types are. We will explain what it means for a generic type...
Read more >Covariance and Contravariance In Java - DZone
The solution consists in learning how to use two powerful features of Java generics known as covariance and contravariance.
Read more >Covariance and Contravariance in C# Explained - NDepend
Contravariance is enforced in relation to a particular generic type using in the generic modifier. Contravariance applies to generic parameters type used as ......
Read more >Scala Generics II: Covariance and Contravariance - Apiumhub
A generic class covariant over its abstract type can receive a parameter type of that type or subtypes of that type. ... The...
Read more >An introduction to generic types in Java: covariance and ...
Covariance and contravariance produce some interesting outcomes. Covariant types are read-only, while contravariant types are write-only.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It would be so great if Hegel supported explicit variance annotations like it’s done in Scala: https://docs.scala-lang.org/tour/variances.html
@leunam217 immutability should be part of type system and should not leak artifacts to production code
you have introduced wrapper class but it is only used for type checking