Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change module exporting type (fix #159) #166

Merged
merged 2 commits into from
Mar 15, 2019
Merged

fix: Change module exporting type (fix #159) #166

merged 2 commits into from
Mar 15, 2019

Conversation

junghwan-park
Copy link
Member

@junghwan-park junghwan-park commented Mar 14, 2019

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

In typescript, to import module by replacing entire exports object(module.exports = {}) must use import someModule = require('that-module');. ref.
module.exports = {} is not equivalent export default {}. Default export matches module.exports.default = {}.

case 1. Replacing exports

module.exports = ImageEditor;
// --------------------------------------

import ImageEditor = require('tui-image-editor');

case 2. Default export

module.exports.default = ImageEditor;
// or
export default ImageEditor;
// --------------------------------------

import ImageEditor from 'tui-image-editor';

Change module exporting type default to commonjs pattern.
ref: #159


Thank you for your contribution to TOAST UI product. πŸŽ‰ 😘 ✨

@junghwan-park junghwan-park self-assigned this Mar 14, 2019
@junghwan-park junghwan-park marked this pull request as ready for review March 15, 2019 00:18
@dongsik-yoo
Copy link
Contributor

μˆ˜κ³ ν•˜μ…¨μŠ΅λ‹ˆλ‹€.
docs μ–΄λ”˜κ°€μ— κ°€μ΄λ“œλ₯Ό λͺ…μ‹œν•΄ μ£Όλ©΄ 쒋을 κ±° κ°™μ•„μš”.
κ΄€λ ¨ 링크도 μΆ”κ°€ν•˜λ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.
https://www.typescriptlang.org/docs/handbook/modules.html

image

@jinwoo-kim-nhn
Copy link
Contributor

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€. μˆ˜κ³ ν•˜μ…¨μŠ΅λ‹ˆλ‹€.

@junghwan-park
Copy link
Member Author

@dongsik-yoo λ„€, νƒ€μž…μŠ€ν¬λ¦½νŠΈ λͺ¨λ“ˆ import μ„€λͺ…을 README.md ν•˜λ‹¨μ— μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€!

@junghwan-park junghwan-park merged commit c9671c1 into master Mar 15, 2019
@junghwan-park junghwan-park deleted the type branch March 15, 2019 03:47
HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
* fix: Change module exporting type of index.d.ts fixes nhn#159

* chore: Add TypeScript module import description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants