alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.17k stars 320 forks source link

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

Closed romaricpascal closed 1 month ago

romaricpascal commented 1 month ago

What

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

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