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

Add explicit types #899

Merged
merged 19 commits into from
Aug 20, 2017
Merged

Add explicit types #899

merged 19 commits into from
Aug 20, 2017

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Aug 19, 2017

Fixes #898
Fixes #901
Fixes #903


This change brings in manual typings, previous the automatically generated typings via the declaration property in tsconfig.json contained everything which is not what we want to expose to consumers. After this goes in, typings/xterm.d.ts contains the complete API (excluding addons currently).

There are also simple tests in fixtures/typings-test/ that ensure that TS code compiled against the typing files compiles as expected. I found a bug while writing this which is always a good sign that it's useful 😄


TODO list:

  • Only allow the actual event types in on ('a' | 'b')
  • Provide types in on event listeners https://xtermjs.org/docs/api/terminal/#events
  • Only allow the actual addon types in loadAddon ('a' | 'b')
  • Ensure comments work for functions with overloads (getOption/setOption)
  • Add a comment for each function with an overload
  • Remove general function declarations when there are overloads?
  • Consider adding addon interfaces to the .d.ts (maybe later?)
  • Add the link matcher API with experimental notice
  • Can we test this? We want CI to reject things like Terminal.scrollDisp getting removed or renamed
  • Should we remove the overloads in getOption, etc. from src/ so they're not duplicated?
  • Add tests for bellSound/bellStyle added in If bell() gets called emit bell event and add default bell sound #878
  • Clean up and finalize valid options Remove dead options from DEFAULT_OPTIONS #897

@Tyriar Tyriar added the work-in-progress Do not merge label Aug 19, 2017
@Tyriar Tyriar added this to the 3.0.0 milestone Aug 19, 2017
@Tyriar Tyriar self-assigned this Aug 19, 2017
@Tyriar
Copy link
Member Author

Tyriar commented Aug 19, 2017

Neat 😄

screen shot 2017-08-18 at 5 31 17 pm

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 71.335% when pulling 3ba3638 on Tyriar:898_explicit_typings into ae0d5e4 on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage remained the same at 71.864% when pulling 92ac427 on Tyriar:898_explicit_typings into ae0d5e4 on sourcelair:v3.

@Tyriar
Copy link
Member Author

Tyriar commented Aug 19, 2017

screen shot 2017-08-18 at 5 45 54 pm

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 71.335% when pulling e4e2fbf on Tyriar:898_explicit_typings into ae0d5e4 on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.04%) to 71.899% when pulling 6e2ca0a on Tyriar:898_explicit_typings into ae0d5e4 on sourcelair:v3.

Tyriar added 2 commits August 19, 2017 10:22
src/ handles more than that specified (and should incase you're not
using TS), this also reduces duplication as the definitions are only
in typings/
@Tyriar Tyriar removed the work-in-progress Do not merge label Aug 19, 2017
@Tyriar Tyriar requested a review from parisk August 19, 2017 17:30
@Tyriar
Copy link
Member Author

Tyriar commented Aug 19, 2017

Ready for review, updated top comment to explain the change more.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.05%) to 71.915% when pulling 34f5b2c on Tyriar:898_explicit_typings into ae0d5e4 on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.04%) to 71.838% when pulling 34e1ee2 on Tyriar:898_explicit_typings into 9ab17de on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.04%) to 71.838% when pulling f520e27 on Tyriar:898_explicit_typings into 9ab17de on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.04%) to 71.838% when pulling f520e27 on Tyriar:898_explicit_typings into 9ab17de on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.06%) to 71.851% when pulling 8fdedd4 on Tyriar:898_explicit_typings into 9ab17de on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.08%) to 71.877% when pulling c984013 on Tyriar:898_explicit_typings into 9ab17de on sourcelair:v3.

@coveralls
Copy link

coveralls commented Aug 19, 2017

Coverage Status

Coverage increased (+0.08%) to 71.851% when pulling a0d8e3c on Tyriar:898_explicit_typings into f251047 on sourcelair:v3.

Copy link
Contributor

@parisk parisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍. Two questions:

  1. Can we be a bit more lenient with the bellStyle option in order to allow null and convert it internally to none?
  2. Should we ditch the geometry option (Deprecate geometry option in favor of rows and cols #841)?

@Tyriar
Copy link
Member Author

Tyriar commented Aug 20, 2017

@parisk

  1. 👍
  2. I was starting to go through the breaking changes but thought maybe I should stop as the PR is already huge.

@Tyriar
Copy link
Member Author

Tyriar commented Aug 20, 2017

I allowed null for cursorStyle as well since it's similar to bellStyle.

@coveralls
Copy link

coveralls commented Aug 20, 2017

Coverage Status

Coverage increased (+0.004%) to 71.773% when pulling eda9443 on Tyriar:898_explicit_typings into f251047 on sourcelair:v3.

@Tyriar Tyriar merged commit 7645bdd into xtermjs:v3 Aug 20, 2017
@Tyriar Tyriar deleted the 898_explicit_typings branch August 20, 2017 17:34
@Tyriar Tyriar mentioned this pull request Aug 20, 2017
@Tyriar Tyriar added the breaking-change Breaks API and requires a major version bump label Aug 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Breaks API and requires a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants