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

Correct mainFields type #217

Closed
aaronadamsCA opened this issue Jul 29, 2022 · 1 comment · Fixed by #218
Closed

Correct mainFields type #217

aaronadamsCA opened this issue Jul 29, 2022 · 1 comment · Fixed by #218

Comments

@aaronadamsCA
Copy link
Contributor

The type of mainFields is set to string[] in a few places, including the signature of createMatchPathAsync.

The correct type is (string | string[])[]:

https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/types.d.ts#L9767

This test case confirms the type is correct:

https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/test/TestCases.template.js#L149-L156

For type safety, it would be great if this package were compatible with the Webpack type of mainFields, foregoing the need for type assertions. Thanks!

@aaronadamsCA
Copy link
Contributor Author

Here's the reason this syntax exists:

webpack/webpack#7204 (comment)

It's probably not very commonly used, but it'd still be good to be compatible with Webpack here.

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 a pull request may close this issue.

1 participant