refine
refine copied to clipboard
[BUG] types are not exported
Describe the bug
It's not possible to import { ValidationErrors } from '@refinedev/core';
There are many unexported types, i'm using ValidationErrors as an example.
Steps To Reproduce
import { ValidationErrors } from '@refinedev/core'
Expected behavior
All types defined by @refinedev/core are exported in the library's index.
Packages
@refinedev/[email protected]
Additional Context
A temporary workaround
import type { ValidationErrors } from '@refinedev/core/dist/contexts/data/types';
Hey @borisyordanov, sorry for the issue! It seems that we forgot to export this type. If you wish, you can send a PR for this. We would be happy to see your contribution. Check out our Contributing Guide to get started! 🚀
As a workaround, I think you can use HttpError type and access the errors property with something like below:
import type { HttpError } from "@refinedev/core";
type ValidationErrors = NonNullable<HttpError["errors"]>;
To make the issue clear for everyone willing to contribute, can you give us a list of types that are missing from the exports? 🙏
@aliemir I can make a list, but don't think it'd be practical in the long term to keep the list up-to-date. My advice is to export everything by default. This is what other popular libraries are doing.
If this is OK with you I'll submit my PR for review
@borisyordanov, especially in @refinedev/core we have many internal stuff which we don't want to expose to users to avoid confusion. We're planning using subpath exports and tidy-up our exports, then we can use asterisk re-exports at index.ts safely. For now, we're not planning to use * re-exports 🙏
Hi @aliemir, I'd like to fix this and add any other types that are missing from the exports too.
Hey @FatimaSaleem21 assigning issue to you.