Enable strict lints
An attempt to fix https://github.com/vector-im/element-call/issues/1132
This commit is contained in:
@@ -55,7 +55,7 @@ export interface Grid {
|
||||
cells: Cell[];
|
||||
}
|
||||
|
||||
interface SparseGrid {
|
||||
export interface SparseGrid {
|
||||
columns: number;
|
||||
/**
|
||||
* The cells of the grid, in left-to-right top-to-bottom order.
|
||||
@@ -803,7 +803,7 @@ export function setTileSize<G extends Grid | SparseGrid>(
|
||||
|
||||
const result: SparseGrid = gridWithoutTile;
|
||||
placeTile(to, toEnd, result);
|
||||
return fillGaps(result, true, (i) => inArea(i, to, toEnd, g)) as G;
|
||||
return fillGaps(result, true, (i: number) => inArea(i, to, toEnd, g)) as G;
|
||||
} else if (toWidth >= fromWidth && toHeight >= fromHeight) {
|
||||
// The tile is growing, which might be able to happen in-place
|
||||
const to = findNearestCell(
|
||||
@@ -1054,7 +1054,8 @@ export const BigGrid: Layout<Grid> = {
|
||||
emptyState: { columns: 4, cells: [] },
|
||||
updateTiles,
|
||||
updateBounds,
|
||||
getTiles: <T,>(g) => g.cells.filter((c) => c.origin).map((c) => c!.item as T),
|
||||
getTiles: <T,>(g: Grid) =>
|
||||
g.cells.filter((c) => c.origin).map((c) => c!.item as T),
|
||||
canDragTile: () => true,
|
||||
dragTile,
|
||||
toggleFocus: cycleTileSize,
|
||||
|
||||
@@ -271,10 +271,19 @@ export function NewVideoGrid<T>({
|
||||
// gesture using the much more sensible ref-based method.
|
||||
const onTileDrag = (
|
||||
tileId: string,
|
||||
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
tap,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
initial: [initialX, initialY],
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
delta: [dx, dy],
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
last,
|
||||
}: Parameters<Handler<"drag", EventTypes["drag"]>>[0]
|
||||
) => {
|
||||
@@ -325,6 +334,8 @@ export function NewVideoGrid<T>({
|
||||
const scrollOffset = useRef(0);
|
||||
|
||||
useScroll(
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
({ xy: [, y], delta: [, dy] }) => {
|
||||
scrollOffset.current = y;
|
||||
|
||||
|
||||
@@ -695,7 +695,7 @@ function getSubGridPositions(
|
||||
// Calculates the number of possible tiles that can be displayed
|
||||
function displayedTileCount(
|
||||
layout: Layout,
|
||||
tileCount,
|
||||
tileCount: number,
|
||||
gridWidth: number,
|
||||
gridHeight: number
|
||||
): number {
|
||||
@@ -854,7 +854,7 @@ export function VideoGrid<T>({
|
||||
tilePositions: [],
|
||||
});
|
||||
const [scrollPosition, setScrollPosition] = useState<number>(0);
|
||||
const draggingTileRef = useRef<DragTileData>(null);
|
||||
const draggingTileRef = useRef<DragTileData | null>(null);
|
||||
const lastTappedRef = useRef<{ [index: Key]: number }>({});
|
||||
const lastLayoutRef = useRef<Layout>(layout);
|
||||
const isMounted = useIsMounted();
|
||||
@@ -1189,11 +1189,23 @@ export function VideoGrid<T>({
|
||||
const onTileDrag = (
|
||||
tileId: string,
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
active,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
xy,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
movement,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
tap,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
last,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
event,
|
||||
}: Parameters<Handler<"drag", EventTypes["drag"]>>[0]
|
||||
) => {
|
||||
@@ -1345,7 +1357,11 @@ export function VideoGrid<T>({
|
||||
|
||||
const bindGrid = useGesture(
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
onWheel: (e) => onGridGesture(e, true),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
onDrag: (e) => onGridGesture(e, false),
|
||||
},
|
||||
{}
|
||||
|
||||
@@ -136,7 +136,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
|
||||
<AudioButton
|
||||
key="localVolume"
|
||||
className={styles.button}
|
||||
volume={(sfuParticipant as RemoteParticipant).getVolume()}
|
||||
volume={(sfuParticipant as RemoteParticipant).getVolume() ?? 0}
|
||||
onPress={onOptionsPress}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ const LocalVolume: React.FC<LocalVolumeProps> = ({
|
||||
participant,
|
||||
}: LocalVolumeProps) => {
|
||||
const [localVolume, setLocalVolume] = useState<number>(
|
||||
participant.getVolume()
|
||||
participant.getVolume() ?? 0
|
||||
);
|
||||
|
||||
const onLocalVolumeChanged = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
|
||||
Reference in New Issue
Block a user