mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-17 18:51:43 -05:00
@smogon is the preferred namespace for packages (eg. @smogon/calc), but the fact that this import logic previously contained code from two non-Smogon sources made such naming awkward. Given the damage calc didn't end up using these sources (and the Pokémon Showdown client doesn't either), its simpler to just remove the logic for third party imports entirely. This allows us to remove ugly 'hidden' JSON5 dependency, as well as `smogon.com/` namespacing on the sources. This commit also tidies up the package.json and type definitions to be more robust. It makes `--access public` the default when publishing and cleans up unpkg support. This is obviously a breaking change, but it's also a package rename so we get to start the version from zero there :). A corresponding commit will be added to the client to account for these changes.
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
export declare type StatName = 'hp' | 'atk' | 'def' | 'spa' | 'spd' | 'spe';
|
|
export type StatsTable<T = number> = {[stat in StatName]: T};
|
|
export interface PokemonSet<T = string> {
|
|
name: string;
|
|
species: T;
|
|
item: T;
|
|
ability: T;
|
|
moves: T[];
|
|
nature: T;
|
|
gender: string;
|
|
evs: StatsTable;
|
|
ivs: StatsTable;
|
|
level: number;
|
|
shiny?: boolean;
|
|
happiness?: number;
|
|
pokeball?: T;
|
|
hpType?: string;
|
|
}
|
|
export declare type DeepPartial<T> = {
|
|
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>;
|
|
};
|
|
export interface GenerationData {
|
|
[formatid: string]: FormatData;
|
|
}
|
|
export interface FormatData {
|
|
[source: string]: {
|
|
[speciesid: string]: {
|
|
[name: string]: DeepPartial<PokemonSet>;
|
|
};
|
|
};
|
|
}
|
|
export type GenerationNum = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
export type Generation = {num: GenerationNum};
|
|
export declare function forGen(gen: Generation | GenerationNum): Promise<GenerationData> | undefined;
|
|
export declare function forFormat(format: string): Promise<FormatData> | undefined;
|
|
export {};
|