Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Created June 18, 2012 22:07
Show Gist options
  • Select an option

  • Save ccapndave/2951016 to your computer and use it in GitHub Desktop.

Select an option

Save ccapndave/2951016 to your computer and use it in GitHub Desktop.
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