refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] types are not exported

Open borisyordanov opened this issue 1 year ago • 6 comments

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';

borisyordanov avatar Jun 12 '24 10:06 borisyordanov

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 avatar Jun 12 '24 10:06 aliemir

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 avatar Jun 12 '24 10:06 aliemir

@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 avatar Jun 12 '24 11:06 borisyordanov

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

aliemir avatar Jun 12 '24 12:06 aliemir

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

FatimaSaleem21 avatar Jun 13 '24 13:06 FatimaSaleem21

Hey @FatimaSaleem21 assigning issue to you.

BatuhanW avatar Jun 21 '24 08:06 BatuhanW