Apply strictNullChecks to src/components/auth/* (#10484
* Apply `strictNullChecks` to `src/components/auth/*` * fix * strict types
This commit is contained in:
committed by
GitHub
parent
af151700c9
commit
f152613f83
@@ -23,4 +23,4 @@ interface AuthHeaderContextType {
|
||||
dispatch: Dispatch<ReducerAction<AuthHeaderReducer>>;
|
||||
}
|
||||
|
||||
export const AuthHeaderContext = createContext<AuthHeaderContextType>(undefined);
|
||||
export const AuthHeaderContext = createContext<AuthHeaderContextType | undefined>(undefined);
|
||||
|
||||
@@ -29,7 +29,7 @@ export function AuthHeaderDisplay({ title, icon, serverPicker, children }: Props
|
||||
if (!context) {
|
||||
return <></>;
|
||||
}
|
||||
const current = context.state.length ? context.state[0] : null;
|
||||
const current = context.state[0] ?? null;
|
||||
return (
|
||||
<Fragment>
|
||||
{current?.icon ?? icon}
|
||||
|
||||
@@ -27,7 +27,7 @@ interface Props {
|
||||
|
||||
export function AuthHeaderModifier(props: Props): null {
|
||||
const context = useContext(AuthHeaderContext);
|
||||
const dispatch = context ? context.dispatch : null;
|
||||
const dispatch = context?.dispatch ?? null;
|
||||
useEffect(() => {
|
||||
if (!dispatch) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user