Skip to content

fix: expose TS types internal to the data engine#1412

Merged
KaiVandivier merged 2 commits intomasterfrom
expose-types
May 29, 2025
Merged

fix: expose TS types internal to the data engine#1412
KaiVandivier merged 2 commits intomasterfrom
expose-types

Conversation

@kabaros
Copy link
Copy Markdown
Collaborator

@kabaros kabaros commented May 27, 2025

This exposes the types in Data service which are often needed by consumers of the app-runtime but currently are not exposed. This led consumers to have to do various workarounds in order to pluck these types, like this for example.

Which this change, the types can be accessed from the top level, i.e. import {QueryRefetchFunction} from 'dhis2/app-runtime'

Notes

  1. Instead of exporting at the top-level, I looked at exporting the types to @dhis2/app-runtime/types. This was mainly as I assumed that the initial intention was these types are internal, so didn't want to make them too obvious. But on second thought, I thought this was unnecessary and looking at other libraries - React for instance - it seems common to expose such types at the top-level.

  2. In some of the services, i.e. config service we explicitly exported some of the types in /types.ts rather than everything - in this PR, I am exposing everything there, mainly because everything in types.ts seems to be useful in the context of Data Provider.

  3. Some other services Offline still don't export the types defined in ./types.ts, I left them for now - it seems like the workarounds are mostly needed for the types under the Data provider - if a need arises to export the other ones, we can do so later.

  4. In order to be able to do export type * from ..., rather than importing and then re-exporting under a namespace, I updated TS version in the devDependencies to version 5 - this is also the version used by the app-shell and the one hoisted by default in dhis2 apps, so this actually brings the runtime consistent with app-shell and platform.

Implements LIBS-769

@kabaros kabaros changed the title fix: expose TS types internal to the engines fix: expose TS types internal to the data engine May 27, 2025
Copy link
Copy Markdown

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

LGTM! Being able to import the types from @dhis2/app-service-data and avoid workarounds is really helpful.

@sonarqubecloud
Copy link
Copy Markdown

@KaiVandivier KaiVandivier merged commit 9803646 into master May 29, 2025
16 checks passed
@KaiVandivier KaiVandivier deleted the expose-types branch May 29, 2025 06:52
dhis2-bot added a commit that referenced this pull request May 29, 2025
## [3.14.2](v3.14.1...v3.14.2) (2025-05-29)

### Bug Fixes

* expose TS types internal to the data engine ([#1412](#1412)) ([9803646](9803646))
@dhis2-bot
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants