namespace ReturnsShapeAsReturnsTriangle { class Shape { } declare const TriangleType ; class Triangle extends Shape { [ TriangleType ] : void ; } declare function makeTriangle ( ) ; declare function makeShape ( ) ; function useFactory ( factory ) { return factory ( ) ; } let shape2 = useFactory ( makeTriangle ) ; }