Skip to content

Add "readonly" modifier for property and constants #86

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

Merged
merged 2 commits into from
Apr 4, 2016
Merged

Conversation

zhengbli
Copy link
Contributor

@zhengbli zhengbli commented Apr 1, 2016

Fix #55

@@ -212,7 +212,8 @@ let EmitEnums () =

let EmitProperties flavor prefix (emitScope: EmitScope) (i: Browser.Interface)=
let emitPropertyFromJson (p: ItemsType.Root) =
Pt.printl "%s%s: %s;" prefix p.Name.Value p.Type.Value
let readOnlyModifier = if p.Readonly.IsSome && p.Readonly.Value = true && prefix = "" then "readonly " else ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

match p.Readonly with
| Some(true) when prefix = "" -> "readonly "
| _ -> ""

@DanielRosenwasser
Copy link
Member

👍

@mhegazy
Copy link
Contributor

mhegazy commented Apr 4, 2016

yaaay. 👍

@zhengbli zhengbli merged commit 9de22cf into master Apr 4, 2016
@zhengbli zhengbli deleted the readonly branch April 4, 2016 19:49
orta pushed a commit to orta/TSJS-lib-generator that referenced this pull request Jun 23, 2021
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

Successfully merging this pull request may close these issues.

4 participants