Created
June 18, 2012 22:07
-
-
Save ccapndave/2951016 to your computer and use it in GitHub Desktop.
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
| extern class State { | |
| public static function create(options:State):State; | |
| @:optional public var route:String; | |
| } | |
| // I am aiming for type safety for something like: | |
| var state = State.create({route:"Hello", somethingRandom: 1}); | |
| // If instead I do | |
| extern class State { | |
| public static function create(options:StateDef):State; | |
| @:optional public var route:String; | |
| } | |
| typedef StateDef = { | |
| var route:String; | |
| } | |
| // it works out, but then I can't add any extra dynamic properties and somethingRandom throws an error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment