-
Notifications
You must be signed in to change notification settings - Fork 19
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:genderandlevel;Sets.importSetreturnsundefinedwhen given a string containing only spaces;Sets.canonicalizethrows when given aPokemonSetpartial that doesn't havespeciesormoves— 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 iterableExpected 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working