Created
July 31, 2025 17:00
-
-
Save va9iff/e32dde1ce663151743f6c2cb6098cc26 to your computer and use it in GitHub Desktop.
Inferred empty arrays, even with static methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A { | |
| static foo() { | |
| return true ? [] : [ new this() ] | |
| } | |
| } | |
| const arr = A.foo() // type: A[] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nevermind. I made it to be able to extend and then use
.allwhile having the extended class type inferred. but no, if I doclass B extends A{}; new B().allit still sees it asA[]