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 { colorTypeGradients } from 'components/utils';
|
||||||
import GenderRate from 'components/GenderRate';
|
import GenderRate from 'components/GenderRate';
|
||||||
import Delayed from 'components/Delayed';
|
import Delayed from 'components/Delayed';
|
||||||
import EvolutionSpecies, {
|
import EvolutionSpecies from 'components/EvolutionSpecies';
|
||||||
EvolutionSpeciesProps,
|
import { InfoDialogDetails } from 'features/InfoDialog/infoDialogSlice';
|
||||||
} from 'components/EvolutionSpecies';
|
|
||||||
|
|
||||||
export interface Stat {
|
export interface Stat {
|
||||||
stat__name: string;
|
stat__name: string;
|
||||||
stat__value: number;
|
stat__value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InfoDialogComponentProps {
|
export type InfoDialogComponentProps = InfoDialogDetails & {
|
||||||
openDialog: boolean;
|
openDialog: boolean;
|
||||||
closeDialog: () => void;
|
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 = ({
|
const InfoDialog = ({
|
||||||
openDialog,
|
openDialog,
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
PokemonSpeciesResponseData,
|
PokemonSpeciesResponseData,
|
||||||
} from 'types/api';
|
} from 'types/api';
|
||||||
|
|
||||||
type InfoDiaglogDetails = {
|
export type InfoDialogDetails = {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
genera: string;
|
genera: string;
|
||||||
@ -28,7 +28,7 @@ type InfoDiaglogDetails = {
|
|||||||
evolutionChain: EvolutionSpeciesProps[];
|
evolutionChain: EvolutionSpeciesProps[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialInfoDialogDetails: InfoDiaglogDetails = {
|
const initialInfoDialogDetails: InfoDialogDetails = {
|
||||||
id: 0,
|
id: 0,
|
||||||
name: '',
|
name: '',
|
||||||
genera: '',
|
genera: '',
|
||||||
@ -45,7 +45,7 @@ const initialInfoDialogDetails: InfoDiaglogDetails = {
|
|||||||
|
|
||||||
export type InfoDialogStateProps = {
|
export type InfoDialogStateProps = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
InfoDialogDetails: InfoDiaglogDetails;
|
InfoDialogDetails: InfoDialogDetails;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialState: InfoDialogStateProps = {
|
export const initialState: InfoDialogStateProps = {
|
||||||
@ -90,7 +90,7 @@ export const constructPokemonInfoFromResponses = (
|
|||||||
fetchedPokemon: PokemonResponseData,
|
fetchedPokemon: PokemonResponseData,
|
||||||
fetchedPokemonSpecies: PokemonSpeciesResponseData,
|
fetchedPokemonSpecies: PokemonSpeciesResponseData,
|
||||||
evolutionChain: EvolutionSpeciesProps[],
|
evolutionChain: EvolutionSpeciesProps[],
|
||||||
): InfoDiaglogDetails => {
|
): InfoDialogDetails => {
|
||||||
return {
|
return {
|
||||||
id: fetchedPokemon.id,
|
id: fetchedPokemon.id,
|
||||||
name: fetchedPokemon.name,
|
name: fetchedPokemon.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user