fix: mark names field in ESMExport as possibly undefined#273
Conversation
`names` can be null with star exports. Upstream fix to improve ts: unjs/mlly#273 Fixes nuxt#309
|
Thanks for PR and sorry for late reply. I love the internal type util for regexes! However, considering the types already declare |
No worries!
I don't have a strong opinion on this. I guess you can make a case for both: returning an empty array would be slightly easier to use, while making Let me know what you prefer and I'll implement it. |
|
I think mainly for the sake of not breaking current deps (that assume names is not nullable based on types) it would be a faster solution to set an empty array. I agree about benefits of making it optional, perhaps we can do it in next major versions. |
The
namesfield inESMExportcould be undefined as (indirectly) has been reported in nuxt/module-builder#309.This is now properly reflected in the types. Moreover, the regex group matches are now typed correctly.