jsQR
jsQR copied to clipboard
Fix exports type definitions
According to the type definitions, this library had to be used like this:
// CJS
const jsQR = require('jsqr')
jsQR.default(/* … */)
// ESM
import jsQR from 'jsqr'
jsQR.default(/* … */)
However, this doesn’t match the instructions from the readme.
This issue has become more apparent since the introduction of the "module": "node16"
option in TypeScript 4.7. The correct way to type module.exports =
is export =
.
People can still use default imports when compiling to CJS. This requires them to use the esModuleInterop
option (which they need anyway if they want to use it with other libraries).
This is needed to fix the type imports if not there's no way to compile the TS build