Skip to content

Instantly share code, notes, and snippets.

@jasonrhodes
Created November 2, 2018 14:44
Show Gist options
  • Save jasonrhodes/154283bd7a525397c221b13fb8cda78e to your computer and use it in GitHub Desktop.
Save jasonrhodes/154283bd7a525397c221b13fb8cda78e to your computer and use it in GitHub Desktop.
implicit function naming quirk?
// file1a.js
const CoolName = () => 'cool'
export { CoolName }
// file2a.js
import { CoolName } from './file1a'
console.log(CoolName.name) // -> "CoolName"
/**
* implicit function names derived from variable assignment, nice ok cool cool
*
* but wait ----------------------------------------------------------------------
*/
// file1b.js
export const CoolName = () => 'cool'
// file2b.js
import { CoolName } from './file1b'
console.log(CoolName.name) // -> undefined
/**
* WHYYYYYY
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment