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

fix: use internal alias that won't collide with user aliases #9022

Merged
merged 5 commits into from
Feb 14, 2023

Conversation

benmccann
Copy link
Member

closes #9009

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed lint is failing - rescinding my approval!

@Rich-Harris
Copy link
Member

The obvious solution would be to declare module '@sveltejs/kit/paths' but that would mean users see it. I don't think I see an alternative to adding // @ts-expect-error to every import

@Conduitry
Copy link
Member

Can we switch to something like $$internal instead?

@Rich-Harris
Copy link
Member

We could, though it only really downgrades the chance of collisions from 'unlikely' to 'very unlikely'

@benmccann
Copy link
Member Author

Hmm. Yeah, I guess there's no way to have internal types 😝 I think I'd probably go with something really unique like __sveltekit_internal or whatever rather than trying to stick @ts-expect-error everywhere

@Rich-Harris
Copy link
Member

It occurs to me that we're currently exposing $internal/paths along with 0SERVER and MANIFEST and various other things that shouldn't be exposed:

image

It would be nice to not do that. If that means a few // @ts-expect-error comments and a smidge less type safety I think it's a price worth paying

@benmccann
Copy link
Member Author

I finally figured out how to make this work without exposing it or using ts-ignore

@Rich-Harris
Copy link
Member

nice!

@Rich-Harris Rich-Harris merged commit 19c0e62 into master Feb 14, 2023
@Rich-Harris Rich-Harris deleted the alias-collision branch February 14, 2023 19:10
@github-actions github-actions bot mentioned this pull request Feb 14, 2023
Rich-Harris added a commit that referenced this pull request Feb 14, 2023
@Rich-Harris Rich-Harris mentioned this pull request Feb 14, 2023
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

Successfully merging this pull request may close these issues.

Possible alias collisions with $internal/paths after 1.4.0+ (#8838)
3 participants