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: make TransformOptions type strict to allow auto-complete #305

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

aryaemami59
Copy link
Contributor

This PR:

  • Fixes the TransformOptions type to not sacrifice auto-completion.

@aryaemami59 aryaemami59 changed the title fix: Fix the TransformOptions type to not sacrifice auto-completion fix: fix the TransformOptions type to not sacrifice auto-completion Sep 26, 2024
@pi0
Copy link
Member

pi0 commented Sep 26, 2024

Can you please elaborate where we loose auto complete?

@aryaemami59
Copy link
Contributor Author

Sure, currently if we have something like this:

createJiti(__filename, { transformOptions: {  } })

When we type inside transformOptions we get no autocompletion.

@pi0
Copy link
Member

pi0 commented Sep 26, 2024

Intresting seems it breaks Omit<TransformOptions, "source"> usage!

@aryaemami59
Copy link
Contributor Author

Intresting seems it breaks Omit<TransformOptions, "source"> usage!

In what way?

@pi0
Copy link
Member

pi0 commented Sep 26, 2024

Actually this line is the problem. not sure why we had it before but removing has same effort (yet we can keep extendable interface consistent with other current types)

@aryaemami59
Copy link
Contributor Author

Yeah, that's why I removed that line, it was there before, not sure why. Does it look okay the way it is now? Or do you want me to make some other changes to it?

@pi0
Copy link
Member

pi0 commented Sep 26, 2024

I think removing that line should only be enough as it was tested locally so we can keep the interface mainly for consistency.

@aryaemami59
Copy link
Contributor Author

aryaemami59 commented Sep 26, 2024

I get: TS2339: Property 'babel' does not exist on type 'Omit<TransformOptions, "source">'., I'll add a babel property to fix it.

@pi0 pi0 changed the title fix: fix the TransformOptions type to not sacrifice auto-completion fix: make TransformOptions type strict to allow auto-complete Sep 26, 2024
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pi0 pi0 merged commit a5cfae9 into unjs:main Sep 26, 2024
7 checks passed
@aryaemami59 aryaemami59 deleted the fix-TransformOptions-type branch September 26, 2024 11:11
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.

2 participants