Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Enable strictNullChecks and noImplicitAny (#11194)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jul 6, 2023
1 parent b467d07 commit 3c81f30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/views/dialogs/BaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ export default class BaseDialog extends React.Component<IProps> {
public constructor(props: IProps) {
super(props);

this.matrixClient = MatrixClientPeg.get();
// XXX: The contract on MatrixClientContext says it is only available within a LoggedInView subtree,
// given that modals function outside the MatrixChat React tree this simulates that. We don't want to
// use safeGet as it throwing would mean we cannot use modals whilst the user isn't logged in.
// The longer term solution is to move our ModalManager into the React tree to inherit contexts properly.
this.matrixClient = MatrixClientPeg.get()!;
}

private onKeyDown = (e: KeyboardEvent | React.KeyboardEvent): void => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/views/dialogs/ScrollableBaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export default abstract class ScrollableBaseModal<
}

protected get matrixClient(): MatrixClient {
return MatrixClientPeg.get();
// XXX: The contract on MatrixClientContext says it is only available within a LoggedInView subtree,
// given that modals function outside the MatrixChat React tree this simulates that. We don't want to
// use safeGet as it throwing would mean we cannot use modals whilst the user isn't logged in.
// The longer term solution is to move our ModalManager into the React tree to inherit contexts properly.
return MatrixClientPeg.get()!;
}

private onKeyDown = (e: KeyboardEvent | React.KeyboardEvent): void => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"module": "commonjs",
"moduleResolution": "node",
"target": "es2016",
"noImplicitAny": false,
"noImplicitAny": true,
"noUnusedLocals": true,
"sourceMap": false,
"outDir": "./lib",
Expand All @@ -16,6 +16,7 @@
"lib": ["es2020", "dom", "dom.iterable"],
"alwaysStrict": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"noImplicitThis": true
},
"include": [
Expand Down

0 comments on commit 3c81f30

Please sign in to comment.