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 strictNullChecks errors in AccessibilityManager #1320

Merged
merged 1 commit into from
Mar 12, 2018

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Mar 9, 2018

Part of #1319


@mofux @parisk this is what strictNullChecks looks like, the changes were necessary to clear all these errors:

src/AccessibilityManager.ts(97,5): error TS2322: Type 'null' is not assignable to type 'IDisposable[]'.
src/AccessibilityManager.ts(98,5): error TS2322: Type 'null' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(99,5): error TS2322: Type 'null' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(100,5): error TS2322: Type 'null' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(101,5): error TS2322: Type 'null' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(102,5): error TS2322: Type 'null' is not assignable to type 'HTMLElement[]'.
src/AccessibilityManager.ts(127,7): error TS2322: Type 'HTMLElement | undefined' is not assignable to type 'HTMLElement'.
  Type 'undefined' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(130,7): error TS2322: Type 'HTMLElement | undefined' is not assignable to type 'HTMLElement'.
  Type 'undefined' is not assignable to type 'HTMLElement'.
src/AccessibilityManager.ts(176,38): error TS2345: Argument of type 'HTMLElement | undefined' is not assignable to parameter oftype 'Node'.
  Type 'undefined' is not assignable to type 'Node'.
src/AccessibilityManager.ts(220,13): error TS2531: Object is possibly 'null'.

Trades a little bit of flexibility for more compile errors, the most annoying thing to deal with was .pop() on HTMLElement[] would return HTMLElement | undefined. Anyone against using this?

@Tyriar Tyriar added this to the 3.3.0 milestone Mar 9, 2018
@Tyriar Tyriar self-assigned this Mar 9, 2018
@Tyriar Tyriar requested review from parisk and mofux March 9, 2018 19:30
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.

I think the trade-off is totally OK.

LGTM 🍣

@Tyriar Tyriar merged commit d1213e5 into xtermjs:master Mar 12, 2018
@Tyriar Tyriar deleted the 1319/AccessibilityManager branch March 12, 2018 15:51
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.

2 participants