Trying to use type alis extension to replace overlap interface definition
This commit is contained in:
parent
768c84d6b8
commit
bf3cbe886b
@ -7,31 +7,18 @@ import { findPokeTypeAsset } from 'components/PokemonTypes';
|
||||
import { colorTypeGradients } from 'components/utils';
|
||||
import GenderRate from 'components/GenderRate';
|
||||
import Delayed from 'components/Delayed';
|
||||
import EvolutionSpecies, {
|
||||
EvolutionSpeciesProps,
|
||||
} from 'components/EvolutionSpecies';
|
||||
import EvolutionSpecies from 'components/EvolutionSpecies';
|
||||
import { InfoDialogDetails } from 'features/InfoDialog/infoDialogSlice';
|
||||
|
||||
export interface Stat {
|
||||
stat__name: string;
|
||||
stat__value: number;
|
||||
}
|
||||
|
||||
export interface InfoDialogComponentProps {
|
||||
export type InfoDialogComponentProps = InfoDialogDetails & {
|
||||
openDialog: boolean;
|
||||
closeDialog: () => void;
|
||||
id: number;
|
||||
name: string;
|
||||
types: string[];
|
||||
genera: string;
|
||||
image: string;
|
||||
height: number;
|
||||
weight: number;
|
||||
genderRatio: number;
|
||||
description: string;
|
||||
abilities: string[];
|
||||
stats: Stat[];
|
||||
evolutionChain: EvolutionSpeciesProps[];
|
||||
}
|
||||
};
|
||||
|
||||
const InfoDialog = ({
|
||||
openDialog,
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
PokemonSpeciesResponseData,
|
||||
} from 'types/api';
|
||||
|
||||
type InfoDiaglogDetails = {
|
||||
export type InfoDialogDetails = {
|
||||
id: number;
|
||||
name: string;
|
||||
genera: string;
|
||||
@ -28,7 +28,7 @@ type InfoDiaglogDetails = {
|
||||
evolutionChain: EvolutionSpeciesProps[];
|
||||
};
|
||||
|
||||
const initialInfoDialogDetails: InfoDiaglogDetails = {
|
||||
const initialInfoDialogDetails: InfoDialogDetails = {
|
||||
id: 0,
|
||||
name: '',
|
||||
genera: '',
|
||||
@ -45,7 +45,7 @@ const initialInfoDialogDetails: InfoDiaglogDetails = {
|
||||
|
||||
export type InfoDialogStateProps = {
|
||||
isOpen: boolean;
|
||||
InfoDialogDetails: InfoDiaglogDetails;
|
||||
InfoDialogDetails: InfoDialogDetails;
|
||||
};
|
||||
|
||||
export const initialState: InfoDialogStateProps = {
|
||||
@ -90,7 +90,7 @@ export const constructPokemonInfoFromResponses = (
|
||||
fetchedPokemon: PokemonResponseData,
|
||||
fetchedPokemonSpecies: PokemonSpeciesResponseData,
|
||||
evolutionChain: EvolutionSpeciesProps[],
|
||||
): InfoDiaglogDetails => {
|
||||
): InfoDialogDetails => {
|
||||
return {
|
||||
id: fetchedPokemon.id,
|
||||
name: fetchedPokemon.name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user