Interesting post, good to hear other people's opinions on this. Personally felt the "considered harmful" title was a little over the top, but I do use export default almost exclusively in TypeScript, unless I'm exporting interfaces or constants.
Like you, the CommonJS interop is a concern of mine, but with TS I'm compiling it down to ES5 so it's not an issue. The remainder of your issues seem to boil down to the need for additional syntax in places and poor tooling, not a lot you can do about the syntax at this point, but VS Code provides great tooling that's improving all the time, especially around the usage of default exports.
Whilst I don't agree with the title and don't think this post should put anyone off using default exports, some of the concerns here are certainly good to consider for people using default exports, so nice work 👍
29
u/ryansmith94 Aug 27 '18
Interesting post, good to hear other people's opinions on this. Personally felt the "considered harmful" title was a little over the top, but I do use export default almost exclusively in TypeScript, unless I'm exporting interfaces or constants.
Like you, the CommonJS interop is a concern of mine, but with TS I'm compiling it down to ES5 so it's not an issue. The remainder of your issues seem to boil down to the need for additional syntax in places and poor tooling, not a lot you can do about the syntax at this point, but VS Code provides great tooling that's improving all the time, especially around the usage of default exports.
Whilst I don't agree with the title and don't think this post should put anyone off using default exports, some of the concerns here are certainly good to consider for people using default exports, so nice work 👍