Created
August 26, 2015 17:28
-
-
Save osbornm/405ad9f76f352ab20279 to your computer and use it in GitHub Desktop.
JS vs TS
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
var things = [ | |
new Thing1(), | |
new Thing1(), | |
new Thing2() | |
]; | |
var OnlyThingOnes = things.filter(function(t){return t.thingOneOnlyProperty !== undefined}); |
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
things: (Thing1|Thing2)[]; | |
//constructor code | |
this.things = [ | |
new Thing1(), | |
new Thing1(), | |
new Thing2() | |
]; | |
var OnlyThingOne = <Thing1[]>this.things.filter(m => (<thing1>m).thingOneOnlyProperty !== undefined); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment