js-codepage
js-codepage copied to clipboard
TS bugfix, export top-level indexer
TS bugfix, export top-level indexer
export default cptable does not equal with module.exports = cptable, it will export like module.exports["default"] = cptable
Coverage remained the same at 97.494% when pulling 3d6bf311b8e93561f220fc30d09b75b7888f967d on karikera:patch-1 into 62fd61e2b7122819fb9a49dc83917d3daee881d9 on SheetJS:master.
One of the comments in the original code was:
/* note: TS cannot export top-level indexer, hence default workaround */
I assume this was in an older version of typescript. Can you verify the new export works in older versions of TS? I think we need to test back to 2.2
So I had to add "strictFunctionTypes": true to types/tsconfig.json. To test the type definitions, make tslint and it shows errors like
/tmp/js-codepage/types/codepage-test.ts:1:8
ERROR: 1:8 expect TypeScript@next compile error:
Module '"/tmp/js-codepage/types/index"' has no default export.
The offending test code was:
import cptable from 'codepage';
This was fixed in the type definition using
export default cptable;
Is there a reason to prefer export = cptable over export default?
@SheetJSDev
export default is not compiled to module.exports = cptable
export default cptable is module.exports['default'] = cptable
this module has errors on TS

