refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
25.92k stars 1.96k forks source link

[BUG] types are not exported #6041

Open borisyordanov opened 2 weeks ago

borisyordanov commented 2 weeks ago

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/core@4.49.1

Additional Context

A temporary workaround import type { ValidationErrors } from '@refinedev/core/dist/contexts/data/types';

aliemir commented 2 weeks ago

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"]>;
aliemir commented 2 weeks ago

To make the issue clear for everyone willing to contribute, can you give us a list of types that are missing from the exports? 🙏

borisyordanov commented 2 weeks ago

@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

aliemir commented 2 weeks ago

@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 🙏

FatimaSaleem21 commented 2 weeks ago

Hi @aliemir, I'd like to fix this and add any other types that are missing from the exports too.

BatuhanW commented 1 week ago

Hey @FatimaSaleem21 assigning issue to you.