Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import type { X as Y } from "@package"; - Import alias doesn't get build properly and get lost #1179

Open
sshmaxime opened this issue Aug 8, 2024 · 0 comments

Comments

@sshmaxime
Copy link

sshmaxime commented Aug 8, 2024

I'm expecting tsup & dts to not change my alias declarations name like import type { X as Y } from "@package"; but it seems like it does indeed remove them. Leading to problem in build types. Is this expected ?

Explanations:
Codesandbox

  1. I'm declaring my types namespace in src/test.ts.
    Info: I'm importing my external package like so import type { PartialDeep as PartialDeepPrimitive } from "type-fest";

  2. It compiles in dist/esm/test.d.ts.
    Info: The import get transformed to import { PartialDeep } from 'type-fest'; and thus exporting that way in my namespace: type PartialDeep<T> = PartialDeep<T>; which is a problem I'm assuming - it seems like it produces a sort of type loop.

  3. When using the builded files in src/index.ts, types.PartialDeep logically resolves to any.

Can someone explain why it does this and if I can fix this quickly with a param or if this is just an actual issue ?

Thanks :)

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@sshmaxime sshmaxime changed the title import type { X as Y } from "@package; - Import alias doesn't get build properly and get lost import type { X as Y } from "@package"; - Import alias doesn't get build properly and get lost Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant