diff --git a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx index 2d7d0b10e5a..976e030b3be 100644 --- a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx +++ b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx @@ -70,7 +70,6 @@ describe('', () => { const wrapper = renderIntoDocument( // wrap in element so renderIntoDocument can render functional component - { /* @ts-ignore */ } , ) as HTMLSpanElement; diff --git a/test/components/views/voip/VoiceChannelRadio-test.tsx b/test/components/views/voip/VoiceChannelRadio-test.tsx index d53d7a2daa8..9ab3c279374 100644 --- a/test/components/views/voip/VoiceChannelRadio-test.tsx +++ b/test/components/views/voip/VoiceChannelRadio-test.tsx @@ -79,7 +79,6 @@ describe("VoiceChannelRadio", () => { }); it("shows when connecting voice", async () => { - // @ts-ignore - TS doesn't like mounting this for some reason, but is fine with it elsewhere const radio = mount(); expect(radio.children().children().exists()).toEqual(false); @@ -90,7 +89,6 @@ describe("VoiceChannelRadio", () => { it("hides when disconnecting voice", () => { VoiceChannelStore.instance.connect("!1:example.org"); - // @ts-ignore - TS doesn't like mounting this for some reason, but is fine with it elsewhere const radio = mount(); expect(radio.children().children().exists()).toEqual(true); @@ -102,7 +100,6 @@ describe("VoiceChannelRadio", () => { describe("disconnect button", () => { it("works", () => { VoiceChannelStore.instance.connect("!1:example.org"); - // @ts-ignore - TS doesn't like mounting this for some reason, but is fine with it elsewhere const radio = mount(); act(() => { @@ -115,7 +112,6 @@ describe("VoiceChannelRadio", () => { describe("video button", () => { it("works", () => { VoiceChannelStore.instance.connect("!1:example.org"); - // @ts-ignore - TS doesn't like mounting this for some reason, but is fine with it elsewhere const radio = mount(); act(() => { @@ -133,7 +129,6 @@ describe("VoiceChannelRadio", () => { describe("audio button", () => { it("works", () => { VoiceChannelStore.instance.connect("!1:example.org"); - // @ts-ignore - TS doesn't like mounting this for some reason, but is fine with it elsewhere const radio = mount(); act(() => { diff --git a/test/test-utils/wrappers.tsx b/test/test-utils/wrappers.tsx index 24205cfa73c..faaf5bf6a73 100644 --- a/test/test-utils/wrappers.tsx +++ b/test/test-utils/wrappers.tsx @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, { RefCallback } from "react"; +import React, { RefCallback, ComponentType } from "react"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg'; import MatrixClientContext from "../../src/contexts/MatrixClientContext"; -type WrapperType = React.Component<{ wrappedRef?: RefCallback }>; +type WrapperProps = { wrappedRef?: RefCallback> } & T; -export function wrapInMatrixClientContext(WrappedComponent): WrapperType { - class Wrapper extends React.Component<{ wrappedRef?: RefCallback }> { +export function wrapInMatrixClientContext(WrappedComponent: ComponentType): ComponentType> { + class Wrapper extends React.Component> { _matrixClient: MatrixClient; constructor(props) { super(props); @@ -37,5 +37,5 @@ export function wrapInMatrixClientContext(WrappedComponent): WrapperType { ; } } - return Wrapper as unknown as WrapperType; + return Wrapper; }