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 the TS types for the drag mode, smoothing quality and view mode options #550

Merged
merged 1 commit into from
Jul 17, 2019

Conversation

stof
Copy link
Contributor

@stof stof commented Jul 16, 2019

Summary

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No (to be confirmed by some typescript user)

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

Other information:

The enums don't exist at runtime (as the source code does not have them as it is not TS). So declaring them as enum causes issues. I got tsc warnings when trying to run it to check the JS code. Passing move explicitly was not considered as a valid value for the drag option.

String enums are replaced with a union of literal types. The ViewMode is turned into a const enum so that typescript will inline the numbers during compilation instead of trying to access them on an object.

The switch from enum to a union of literals should be checked by TS users to see whether it breaks BC (but I think it was not working at all before).

…ptions

The enums don't exist at runtime (as the source code does not have them). So declaring them as enum causes issues.

String enums are replaced with a union of literal types. The ViewMode is turned into a const enum so that typescript will inline the numbers during compilation.
@codecov-io
Copy link

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #550   +/-   ##
=======================================
  Coverage   72.65%   72.65%           
=======================================
  Files           9        9           
  Lines        1532     1532           
=======================================
  Hits         1113     1113           
  Misses        419      419

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 1eae10c...1750a8a. Read the comment docs.

@fengyuanchen fengyuanchen merged commit f4e306f into fengyuanchen:master Jul 17, 2019
@stof stof deleted the patch-1 branch July 17, 2019 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants