-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug:
The return value of some of the functions in @pkmn/sets don't match the types assigned to them. Specifically:
Sets.unpackSet
's return potentially lacks two properties fromPokemonSet
:gender
andlevel
;Sets.importSet
returnsundefined
when given a string containing only spaces;Sets.canonicalize
throws when given aPokemonSet
partial that doesn't havespecies
ormoves
— the latter in particular can happen when giving it the output ofSets.importSet
.
Example:
const set1 = Sets.unpackSet("Espeon|||-||||||||");
console.log(set1.gender, set1.level);
// undefined, undefined
const set2 = Sets.importSet("");
console.log(set2);
// undefined
Sets.canonicalize(Sets.importSet("Tangrowth"), Dex);
// Uncaught TypeError: s.moves is not iterable
Expected behavior:
The functions' parameter and return types should match their implementations.
Additional context:
I'd be willing to open a PR to fix the issues, but I'd have to know whether the types or the implementations should be changed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working