Enable @typescript-eslint/explicit-function-return-type in /src (#9788)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier

* Enable `@typescript-eslint/explicit-function-return-type` in /src

* Fix types

* tsc strict fixes

* Delint

* Fix test

* Fix bad merge
This commit is contained in:
Michael Telatynski 2023-01-12 13:25:14 +00:00 committed by GitHub
parent 7a36ba0fde
commit 030b7e90bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
683 changed files with 3459 additions and 3013 deletions

View file

@ -14,7 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ComponentClass, createContext, forwardRef, useContext } from "react";
import React, {
ComponentClass,
createContext,
forwardRef,
PropsWithoutRef,
ForwardRefExoticComponent,
useContext,
RefAttributes,
} from "react";
import { MatrixClient } from "matrix-js-sdk/src/client";
const MatrixClientContext = createContext<MatrixClient>(undefined);
@ -25,11 +33,16 @@ export interface MatrixClientProps {
mxClient: MatrixClient;
}
export function useMatrixClientContext() {
export function useMatrixClientContext(): MatrixClient {
return useContext(MatrixClientContext);
}
const matrixHOC = <ComposedComponentProps extends {}>(ComposedComponent: ComponentClass<ComposedComponentProps>) => {
const matrixHOC = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
): ForwardRefExoticComponent<
PropsWithoutRef<Omit<ComposedComponentProps, "mxClient">> &
RefAttributes<InstanceType<ComponentClass<ComposedComponentProps>>>
> => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
// eslint-disable-next-line react-hooks/rules-of-hooks

View file

@ -68,6 +68,6 @@ const RoomContext = createContext<IRoomState>({
});
RoomContext.displayName = "RoomContext";
export default RoomContext;
export function useRoomContext() {
export function useRoomContext(): IRoomState {
return useContext(RoomContext);
}

View file

@ -78,7 +78,7 @@ export class SdkContextClass {
* Automatically construct stores which need to be created eagerly so they can register with
* the dispatcher.
*/
public constructEagerStores() {
public constructEagerStores(): void {
this._RoomViewStore = this.roomViewStore;
}