Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@:optional was not gen of typedef #38

Open
sonygod opened this issue Nov 9, 2020 · 2 comments
Open

@:optional was not gen of typedef #38

sonygod opened this issue Nov 9, 2020 · 2 comments

Comments

@sonygod
Copy link

sonygod commented Nov 9, 2020

@:expose
typedef GameType ={

  var id:Int;
    var ?name:String;
} 

will gen

export type GameType = {
	id: number;
	name: string;
}

should be

export type GameType = {
	id: number;
	name?: string;
}
@elsassph
Copy link
Owner

elsassph commented Nov 9, 2020

I think your syntax isn't entirely correct (though it may be accepted by the compiler).

For a typedef with var prop: Type it should be:

@:expose
typedef GameType ={
   var id:Int;
   @:optional var name:String;
}

@sonygod
Copy link
Author

sonygod commented Nov 9, 2020

emm,this is got the same result as var ?name:String ==@:optional var name:String;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants