jsarafajr / slackify-markdown

Convert markdown into Slack-specific markdown
MIT License
129 stars 25 forks source link

Fix TypeScript export declaration #15

Closed ellsclytn closed 3 years ago

ellsclytn commented 3 years ago

The module was incorrectly stating that there's a default export, which is not true of the actual code (wherein it has a module.exports equal to the entrypoint).

You can recreate this fairly easily with the following:

tsconfig.json

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "moduleResolution": "node"
  }
}

index.ts

import slackifyMarkdown from 'slackify-markdown'

slackifyMarkdown('test')

This will pass TypeScript compilation, but will fail at runtime because the compiled JavaScript will be looking for a .default property on the module, which is not present.

With this commit applied, tsconfig will require "esModuleInterop": true to pass compilation in the first place, and will work at runtime.

codecov-io commented 3 years ago

Codecov Report

Merging #15 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #15   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           39        39           
  Branches         6         6           
=========================================
  Hits            39        39           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4c7b4b6...e1a7437. Read the comment docs.

jsarafajr commented 3 years ago

Thanks @ellsclytn ❤️