Improve AccessibleButton & related types (#12075)
* Fix wrong type enum usage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use improved type definition for forwardRef which enables Generic props Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve AccessibleButton & related Props types Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove useless comment Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
e26d3e9b68
commit
af31965866
17 changed files with 109 additions and 79 deletions
|
@ -14,15 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, {
|
||||
ComponentClass,
|
||||
createContext,
|
||||
forwardRef,
|
||||
PropsWithoutRef,
|
||||
ForwardRefExoticComponent,
|
||||
useContext,
|
||||
RefAttributes,
|
||||
} from "react";
|
||||
import React, { ComponentClass, createContext, forwardRef, useContext } from "react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
// This context is available to components under LoggedInView,
|
||||
|
@ -42,10 +34,9 @@ export function useMatrixClientContext(): MatrixClient {
|
|||
|
||||
const matrixHOC = <ComposedComponentProps extends {}>(
|
||||
ComposedComponent: ComponentClass<ComposedComponentProps>,
|
||||
): ForwardRefExoticComponent<
|
||||
PropsWithoutRef<Omit<ComposedComponentProps, "mxClient">> &
|
||||
RefAttributes<InstanceType<ComponentClass<ComposedComponentProps>>>
|
||||
> => {
|
||||
): ((
|
||||
props: Omit<ComposedComponentProps, "mxClient"> & React.RefAttributes<InstanceType<typeof ComposedComponent>>,
|
||||
) => React.ReactElement | null) => {
|
||||
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
|
||||
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue