Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TS bugfix, export top-level indexer#19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
karikera wants to merge1 commit intoSheetJS:master
base:master
Choose a base branch
Loading
fromkarikera:patch-1

Conversation

karikera
Copy link

@karikerakarikera commentedMar 5, 2020
edited
Loading

TS bugfix, export top-level indexer

export default cptable does not equal withmodule.exports = cptable, it will export likemodule.exports["default"] = cptable

`export default` will export like `module.exports["default"] = cptable`
@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.494% when pulling3d6bf31 on karikera:patch-1 into62fd61e on SheetJS:master.

@SheetJSDev
Copy link
Contributor

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

@karikera
Copy link
Author

karikera commentedMar 5, 2020
edited
Loading

@SheetJSDev
image

I compiledindex.d.ts without error in TS@2.2

@SheetJSDev
Copy link
Contributor

So I had to add"strictFunctionTypes": true totypes/tsconfig.json. To test the type definitions,make tslint and it shows errors like

/tmp/js-codepage/types/codepage-test.ts:1:8ERROR: 1:8    expect                           TypeScript@next compile error: Module '"/tmp/js-codepage/types/index"' has no default export.

The offending test code was:

importcptablefrom'codepage';

This was fixed in the type definition using

exportdefaultcptable;

Is there a reason to preferexport = cptable overexport default?

@karikera
Copy link
Author

karikera commentedMar 5, 2020
edited
Loading

@SheetJSDev
export default is not compiled tomodule.exports = cptable
export default cptable ismodule.exports['default'] = cptable

this module has errors on TS

image

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@karikera@coveralls@SheetJSDev

[8]ページ先頭

©2009-2025 Movatter.jp