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

Investigate impact on types and TypeScript of our plans for createAll #5209

Closed
3 tasks
Tracked by #5205
romaricpascal opened this issue Aug 8, 2024 · 0 comments
Closed
3 tasks
Tracked by #5205
Assignees

Comments

@romaricpascal
Copy link
Member

romaricpascal commented Aug 8, 2024

What

Investigate how we need to change the types of createAll arguments and return value to allow it to handle:

  • initialising components that did not come from GOV.UK Frontend
  • initialising multiple components in a single call

If necessary, it would be faire to add extra static properties on components (like a lower-case name of the component to pick from an object storing multiple component configuration in a similar shape that the one initAll receives).

If typing becomes too complex, we can also consider having two functions, one for initialising a single type of component and another for a list of components.

Why

As we're looking to make createAll initialise components that do not belong to GOV.UK Frontend and possibly multiple components, we need to figure out how to describe the type of arguments it receives and its return value so our type checking remains accurate.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • We've assessed the impact of allowing createAll to receive components not from GOV.UK Frontend
  • We've assessed the impact of allowing createAll to initialising multiple components in a single call
  • We've recorded the solutions we have to work around both
@romaricpascal romaricpascal changed the title Investigate how to make TypeScript happy with more options for createAll Investigate impact on types and TypeScript of our plans for createAll Aug 8, 2024
@romaricpascal romaricpascal moved this to Backlog 🏃🏼‍♀️ in GOV.UK Design System cycle board Aug 8, 2024
@romaricpascal romaricpascal moved this from Backlog 🏃🏼‍♀️ to Done 🏁 in GOV.UK Design System cycle board Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants