isaacs / tshy

Other
894 stars 18 forks source link

Fix `types` condition to be the first #75

Closed smorimoto closed 5 months ago

smorimoto commented 5 months ago

Ref: https://publint.dev/rules#exports_types_should_be_first

isaacs commented 5 months ago

Types must come before the JS they describe.

But if the goal of any other type dialects here (such as source) is to be able to tell typescript to resolve to it, then that can hardly be effective if typescript will match on types first.

For the same reason, if you use the "types@>=5.4" type of conditional to provide different types to different TS versions, then putting types first would make that impossible.

So, no, this is incorrect. Publint is being overly persnickety on this, and there's no rational reason for it.