mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
Improve context types (#10510)
This commit is contained in:
parent
974dc35c41
commit
b77b2df29b
@ -25,7 +25,10 @@ import React, {
|
||||
} from "react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
|
||||
const MatrixClientContext = createContext<MatrixClient | undefined>(undefined);
|
||||
// This context is available to components under LoggedInView,
|
||||
// the context must not be used by components outside a MatrixClientContext tree.
|
||||
// This assertion allows us to make the type not nullable.
|
||||
const MatrixClientContext = createContext<MatrixClient>(null as any);
|
||||
MatrixClientContext.displayName = "MatrixClientContext";
|
||||
export default MatrixClientContext;
|
||||
|
||||
|
@ -38,7 +38,10 @@ import {
|
||||
VoiceBroadcastRecordingsStore,
|
||||
} from "../voice-broadcast";
|
||||
|
||||
export const SDKContext = createContext<SdkContextClass | undefined>(undefined);
|
||||
// This context is available to components under MatrixChat,
|
||||
// the context must not be used by components outside a SdkContextClass tree.
|
||||
// This assertion allows us to make the type not nullable.
|
||||
export const SDKContext = createContext<SdkContextClass>(null as any);
|
||||
SDKContext.displayName = "SDKContext";
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user