Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jan 15, 2024
1 parent 92bbd73 commit ebd03f0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/pages/cl/ko/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface State {
possiblePairings: readonly number[] | null
pots: FixedArray<readonly Team[], 2>
potsToDisplay: readonly [readonly Team[] | null, readonly Team[]]
matchups: readonly [Team, Team][]
matchups: readonly (readonly [Team] | readonly [Team, Team])[]
}

function getState(initialPots: FixedArray<readonly Team[], 2>): State {
Expand Down Expand Up @@ -85,17 +85,15 @@ function CLKO({ season, pots: initialPots }: Props) {

const groupsContanerRef = useRef<HTMLElement>(null)

// @ts-expect-error Expected
const selectedTeam = matchups.find(m => m.length === 1)?.at(-1)

const getPossiblePairings = useCallback(
async (
newPots: FixedArray<readonly Team[], 2>,
newMatchups: readonly (readonly [Team, Team])[],
newMatchups: readonly (readonly [Team] | readonly [Team, Team])[],
) => {
const [newGwPot, newRuPot] = newPots
const initialGwPot = initialPots[0]
// @ts-expect-error Expected
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
const pickedTeam = newMatchups.find(m => m.length === 1)?.at(-1)!
const groups = initialGwPot.map(gw => {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/el/ko/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface State {
possiblePairings: readonly number[] | null
pots: FixedArray<readonly Team[], 2>
potsToDisplay: readonly [readonly Team[] | null, readonly Team[]]
matchups: readonly [Team, Team][]
matchups: readonly (readonly [Team] | readonly [Team, Team])[]
}

function getState(
Expand Down Expand Up @@ -90,17 +90,15 @@ function ELKO({ season, pots: initialPots }: Props) {

const groupsContanerRef = useRef<HTMLElement>(null)

// @ts-expect-error Expected
const selectedTeam = matchups.find(m => m.length === 1)?.at(-1)

const getPossiblePairings = useCallback(
async (
newPots: FixedArray<readonly Team[], 2>,
newMatchups: readonly (readonly [Team, Team])[],
newMatchups: readonly (readonly [Team] | readonly [Team, Team])[],
) => {
const [newGwPot, newRuPot] = newPots
const initialGwPot = initialPots[0]
// @ts-expect-error Expected
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
const pickedTeam = newMatchups.find(m => m.length === 1)?.at(-1)!
const groups = initialGwPot.map(gw => {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/MatchupsContainer/Matchup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const VersusCell = styled(Content)`
`

interface Props {
teams: [Team, Team] | null
teams: readonly [Team, Team] | readonly [Team] | null
}

function Matchup({ teams }: Props) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/MatchupsContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const RootTable = styled(Table)`
`

interface Props {
matchups: readonly [Team, Team][]
matchups: readonly (readonly [Team] | readonly [Team, Team])[]
}

const MatchupContainer = forwardRef(({ matchups }: Props, ref: any) => (
Expand Down

0 comments on commit ebd03f0

Please sign in to comment.