6 up and 0 down, posted by dragon2x 21 days ago 3 comments
Do others agree with Sindre about not using named exports? My opinion is the exact opposite, to ALWAYS use named exports to provide stricter types. The point about "a chore to import each color manually" is not true when using (for example) TypeScript auto imports.
especially with `import * as foo from "...";` if you *REALLY* want to get it all.
While this approach enforces strict types (eg renaming exports) i prefer my IDE to import the right thing rather than me importing everything. How I import stuff (in vs code):
- write code
- IDE suggests a symbol
- either use symbol (and auto import is added) or ignore
- if ignore suggested symbol, use the `quick fix` actions to import the correct thing
This really is not a chore, and my build will break if I rename symbols (which isn't the case if using default exports, in which case i need to manually scan my project to rename the import to ensure the name I've given it still makes sense.)
What other benefit are there to using `import * as foo from "...";`? (Genuine question as I do not use this approach.)