Closed aaronadamsCA closed 2 years ago
The type of mainFields is set to string[] in a few places, including the signature of createMatchPathAsync.
mainFields
string[]
createMatchPathAsync
The correct type is (string | string[])[]:
(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!
Here's the reason this syntax exists:
https://github.com/webpack/webpack/issues/7204#issuecomment-387843091
It's probably not very commonly used, but it'd still be good to be compatible with Webpack here.
The type of
mainFields
is set tostring[]
in a few places, including the signature ofcreateMatchPathAsync
.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!