1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

include test/test-utils in tsconfig (#8000)

* move js utils into directory

Signed-off-by: Kerry Archibald <kerrya@element.io>

* typescripterize js test-utils

Signed-off-by: Kerry Archibald <kerrya@element.io>

* move test utils to directory

Signed-off-by: Kerry Archibald <kerrya@element.io>

* move remaining mock functions to directory

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update imports

Signed-off-by: Kerry Archibald <kerrya@element.io>

* missed copyright

Signed-off-by: Kerry Archibald <kerrya@element.io>

* type wait for update

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add tests/test-utils to tsconfig

* lint

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix wrapper type

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry
2022-03-09 14:23:58 +01:00
committed by GitHub
parent a71009fca0
commit 2ab8b46ba3
3 changed files with 41 additions and 31 deletions

View File

@ -20,8 +20,10 @@ import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg';
import MatrixClientContext from "../../src/contexts/MatrixClientContext";
export function wrapInMatrixClientContext(WrappedComponent) {
class Wrapper extends React.Component<{ wrappedRef?: RefCallback }> {
type WrapperType<T> = React.Component<{ wrappedRef?: RefCallback<T> }>;
export function wrapInMatrixClientContext<T>(WrappedComponent): WrapperType<T> {
class Wrapper extends React.Component<{ wrappedRef?: RefCallback<T> }> {
_matrixClient: MatrixClient;
constructor(props) {
super(props);
@ -35,5 +37,5 @@ export function wrapInMatrixClientContext(WrappedComponent) {
</MatrixClientContext.Provider>;
}
}
return Wrapper;
return Wrapper as unknown as WrapperType<T>;
}