Skip to content

Commit

Permalink
fix: various type adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Aug 29, 2024
1 parent 77dadb9 commit ab51750
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 33 deletions.
4 changes: 4 additions & 0 deletions packages/types/lib/augmentations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ declare module 'http' {
bodySize?: number
}
}

declare module 'ohbem' {
export = Ohbem
}
19 changes: 3 additions & 16 deletions packages/types/lib/scanner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,7 @@ export interface Pokestop {

export type FullPokestop = FullModel<Pokestop, PokestopModel>

export interface PvpEntry {
pokemon: number
form: number
cap: number
value: number
level: number
cp: number
percentage: number
rank: number
capped: boolean
evolution: number
}

export type CleanPvp = Record<string, PvpEntry[]>
export type CleanPvp = Record<string, import('ohbem').PvPRankEntry[]>

export interface Pokemon {
id: string
Expand Down Expand Up @@ -247,8 +234,8 @@ export interface Pokemon {
expire_timestamp_verified: boolean
updated: number
pvp: CleanPvp
pvp_rankings_great_league?: PvpEntry[]
pvp_rankings_ultra_league?: PvpEntry[]
pvp_rankings_great_league?: import('ohbem').PvPRankEntry[]
pvp_rankings_ultra_league?: import('ohbem').PvPRankEntry[]
distance?: number
shiny?: boolean
}
Expand Down
6 changes: 3 additions & 3 deletions server/src/filters/pokemon/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module.exports = class PkmnBackend {
}

/**
* @param {import("@rm/types").PvpEntry} entry
* @param {import("ohbem").PvPRankEntry} entry
* @param {string} league
* @returns {boolean}
*/
Expand Down Expand Up @@ -226,8 +226,8 @@ module.exports = class PkmnBackend {

/**
* @param {string} league
* @param {import("@rm/types").PvpEntry[]} data
* @returns {{ best: number; filtered: import("@rm/types").PvpEntry[]}}
* @param {import("ohbem").PvPRankEntry[]} data
* @returns {{ best: number; filtered: import("ohbem").PvPRankEntry[]}}
*/
getRanks(league, data) {
const filtered =
Expand Down
2 changes: 1 addition & 1 deletion server/src/filters/pokemon/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { log, TAGS } = require('@rm/logger')

/**
* @param {object} pokemon
* @returns {Record<string, import('@rm/types').PvpEntry[]>}
* @returns {Record<string, import("ohbem").PvPRankEntry[]>}
*/
function getParsedPvp(pokemon) {
if (pokemon.pvp)
Expand Down
3 changes: 1 addition & 2 deletions server/src/services/PvpWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class PvpWrapper extends Ohbem {
constructor() {
super({
leagues: config.getSafe('api.pvp.leagueObj'),
pokemonData: {},
levelCaps: config.getSafe('api.pvp.levels'),
cachingStrategy: Ohbem.cachingStrategies.memoryHeavy,
})
Expand All @@ -24,7 +23,7 @@ class PvpWrapper extends Ohbem {
/**
* @param {import("@rm/types").Pokemon} pokemon
* @param {number} currentTs
* @returns {import("@rm/types").CleanPvp}
* @returns {Record<string, import("ohbem").PvPRankEntry[]>}
*/
resultWithCache(pokemon, currentTs) {
if (pokemon.pokemon_id === 132) return {}
Expand Down
2 changes: 1 addition & 1 deletion src/assets/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ export const FILTER_SKIP_LIST = ['filter', 'enabled', 'legacy']

export const ALWAYS_EXCLUDED = new Set(['donor', 'blockedGuildNames', 'admin'])

export const SCAN_MODES = /** @type */ (['confirmed', 'loading', 'error'])
export const SCAN_MODES = ['confirmed', 'loading', 'error']

export const SCAN_SIZES = /** @type {const} */ (['S', 'M', 'XL'])
2 changes: 1 addition & 1 deletion src/components/filters/Advanced.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import * as React from 'react'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import Dialog from '@mui/material/Dialog'
import DialogContent from '@mui/material/DialogContent'
import List from '@mui/material/List'
Expand Down
2 changes: 1 addition & 1 deletion src/components/filters/SlotSelection.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import * as React from 'react'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import DialogContent from '@mui/material/DialogContent'
import IconButton from '@mui/material/IconButton'
import Divider from '@mui/material/Divider'
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/BoolToggle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ListItem from '@mui/material/ListItem'
import ListItemText from '@mui/material/ListItemText'
import Switch from '@mui/material/Switch'
import List from '@mui/material/List'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import { useTranslation } from 'react-i18next'

import { useDeepStore } from '@store/useStorage'
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/SliderTile.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
/* eslint-disable react/jsx-no-duplicate-props */
import * as React from 'react'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import TextField from '@mui/material/TextField'
import Slider from '@mui/material/Slider'
import { styled } from '@mui/material/styles'
Expand Down
2 changes: 1 addition & 1 deletion src/components/virtual/VirtualGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import * as React from 'react'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import { VirtuosoGrid } from 'react-virtuoso'

const STYLE = /** @type {React.CSSProperties} */ ({
Expand Down
2 changes: 1 addition & 1 deletion src/features/profile/ExtraFields.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import * as React from 'react'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import TextField from '@mui/material/TextField'
import { useMutation } from '@apollo/client'
import { useTranslation } from 'react-i18next'
Expand Down
2 changes: 1 addition & 1 deletion src/features/profile/LinkAccounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useMutation } from '@apollo/client'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import Select from '@mui/material/Select'
import MenuItem from '@mui/material/MenuItem'
import Typography from '@mui/material/Typography'
Expand Down
2 changes: 1 addition & 1 deletion src/features/profile/Permissions.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import Box from '@mui/material/Box'
import Card from '@mui/material/Card'
import CardContent from '@mui/material/CardContent'
Expand Down
2 changes: 1 addition & 1 deletion src/features/search/renderOption.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { t } from 'i18next'
import ListItem from '@mui/material/ListItem'
import ListItemIcon from '@mui/material/ListItemIcon'
import ListItemText from '@mui/material/ListItemText'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import Divider from '@mui/material/Divider'
import Typography from '@mui/material/Typography'

Expand Down
2 changes: 1 addition & 1 deletion src/features/webhooks/tiles/TrackedTile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react'
import DeleteForever from '@mui/icons-material/DeleteForever'
import Edit from '@mui/icons-material/Edit'
import Grid2 from '@mui/material/Unstable_Grid2/Grid2'
import Grid2 from '@mui/material/Unstable_Grid2'
import Typography from '@mui/material/Typography'
import IconButton from '@mui/material/IconButton'
import Checkbox from '@mui/material/Checkbox'
Expand Down

0 comments on commit ab51750

Please sign in to comment.