Improve context types (#10510)
This commit is contained in:
committed by
GitHub
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user