-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(null): strict null checks for injected drawing-controller (#6272)
#### Details This PR adds the injected DrawingController + a few related/dependent files to the strict null check list. The most interesting of the changes was updating the `DrawerInitData` type to not be generic. Previously, it was genericized over the data type an individual drawer expected (in particular, svg-drawer expects to only be used with something special). But the generic type usage meant that in practice, the individual drawers were written looking like they could safely assume what type of input they were given with the relevant `any` conversions happening in the drawer controller/initiator, which wasn't really accurate - if a type assumption was wrong, it'd be the individual drawer that would have to be aware of the mistake. This change moves the type assertions in question to the drawer. Overall, these changes enabled autoadding several more assessment folders and brought us from 78% to 80% null checked: ``` ❯ yarn null:progress yarn run v1.22.19 $ node ./tools/strict-null-checks/progress.js ## Web strict-null progress **80%** complete (**1244**/1562 non-test files) *Contribute at [#2869](#2869). Last update: Fri Dec 16 2022* ``` ##### Motivation #2869 ##### Context n/a #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [x] Addresses an existing issue: #2869 - [x] Ran `yarn null:autoadd` - [x] Ran `yarn fastpass` - [x] Added/updated relevant unit test(s) (and ran `yarn test`) - [x] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage` - [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`. - [n/a] (UI changes only) Added screenshots/GIFs to description above - [n/a] (UI changes only) Verified usability with NVDA/JAWS
- Loading branch information
Showing
16 changed files
with
91 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { AssessmentVisualizationInstance } from 'injected/frameCommunicators/html-element-axe-results-helper'; | ||
import { FeatureFlagStoreData } from '../../common/types/store-data/feature-flag-store-data'; | ||
|
||
export interface Drawer { | ||
initialize(config: DrawerInitData<any>): void; | ||
initialize(config: DrawerInitData): void; | ||
isOverlayEnabled: boolean; | ||
drawLayout(): Promise<void>; | ||
eraseLayout(): void; | ||
} | ||
|
||
export interface DrawerInitData<T> { | ||
data: T[]; | ||
export interface DrawerInitData { | ||
data: AssessmentVisualizationInstance[] | null; | ||
featureFlagStoreData: FeatureFlagStoreData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.