Closed gskyarts closed 4 days ago
the imports will be available, as soon as https://github.com/mittwald/flow/pull/998 is merged: import type { NotificationController } from "@mittwald/flow-react-components/NotificationProvider"; import type { Status } from "@mittwald/flow-react-components/types";
We decided not export named types that can be derived by existing types in every case, because this enlarges the libraries public interface and introduces the risk of breaking type changes. Also we would have to put extra effort into a non-conflicting naming.
But TypeScript offers some helpers to extract types:
import type { AlertProps } from "@mittwald/flow-react-components/Alert";
type AlertStatus = AlertProps["status"];
import type { useNotificationController } from "@mittwald/flow-react-components/NotificationProvider";
type NotificationController = ReturnType<typeof useNotificationController>
FYI: The NotificationController
type will be exported in the PR.
I need the following type for my code
import type NotificationController from "node_modules/@mittwald/flow-react-components/dist/js/types/components/NotificationProvider/NotificationController";
. But as you can see, this looks pretty messy and hacky - it works, but it would be much nicer and cleaner if we could get this as an export.Right now I only have these two cases:
import { type Status } from "node_modules/@mittwald/flow-react-components/dist/js/types/lib/types/props";
import type NotificationController from "node_modules/@mittwald/flow-react-components/dist/js/types/components/NotificationProvider/NotificationController";
Would it be possible to export all types and interfaces? Maybe only these two were forgotten.