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

Enumerable strings to unions #86

Open
johngeorgewright opened this issue May 10, 2024 · 1 comment
Open

Enumerable strings to unions #86

johngeorgewright opened this issue May 10, 2024 · 1 comment

Comments

@johngeorgewright
Copy link

johngeorgewright commented May 10, 2024

I'd like to suggest that enumerable strings be converted to unions.

For example:

<!-- ... -->
<element maxOccurs="1" minOccurs="0" name="adUnitView" type="tns:AdUnitView"/>
<!-- ... -->
<simpleType name="AdUnitView">
  <restriction base="xsd:string">
    <enumeration value="TOP_LEVEL"/>
    <enumeration value="FLAT"/>
    <enumeration value="HIERARCHICAL"/>
  </restriction>
</simpleType>

Would become:

  /** AdUnitView|xsd:string */
  adUnitView?: 'TOP_LEVEL' | 'FLAT' | 'HIERARCHICAL'

Rather than the current implementation:

  /** AdUnitView|xsd:string|TOP_LEVEL,FLAT,HIERARCHICAL */
  adUnitView?: string
@johngeorgewright
Copy link
Author

... or even better having the values available as an enum or object too.

export enum AdUnitView {
  TOP_LEVEL = 'TOP_LEVEL',
  FLAT = 'FLAT',
  HIERARCHICAL = 'HIERARCHICAL'
}

...

  /** AdUnitView|xsd:string */
  adUnitView?: AdUnitView | keyof typeof AdUnitView

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

1 participant