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

Core: support explicit ordering of model properties #6

Open
evanbb opened this issue Apr 1, 2021 · 1 comment
Open

Core: support explicit ordering of model properties #6

evanbb opened this issue Apr 1, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@evanbb
Copy link
Owner

evanbb commented Apr 1, 2021

properties end up getting rendered in declaration order, but the order of iteration isnt guaranteed - fix this :)

@evanbb evanbb added this to the 1.0 milestone Apr 1, 2021
@evanbb
Copy link
Owner Author

evanbb commented Apr 10, 2021

preferring to not add a property like order or priority or something to each model property configuration, i thought it would be good to change from an object

{
  prop1: prop1Config,
  prop2: prop2Config
}

to an ordered array of tuples

// if prop1 should render first:
[
  ['prop1', prop1Config],
  ['prop2', prop2Config],
]
// or, if prop2 should render first:
[
  ['prop2', prop2Config],
  ['prop1', prop1Config],
]

so long as all properties are specified exactly one, order should be up to developer.

building off this microsoft/TypeScript#13298 (comment) gave me a decent, very workable solution, but the code suggestions and error reporting leave a lot to be desired, and beyond 7 properties TS just gives up calculating thousands of permutations, stating Type instantiation is excessively deep and possibly infinite 💔 😭

@evanbb evanbb added enhancement New feature or request good first issue Good for newcomers labels Oct 23, 2021
@evanbb evanbb modified the milestones: 1.0, 1.1 Oct 23, 2021
@evanbb evanbb modified the milestones: 1.1, 1.0 Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant