fotmob
fotmob copied to clipboard
[BUG] TypeError: Cannot read properties of null (reading 'literal')
Is there an existing issue for this?
- [x] I have searched the existing issues
Current Behavior
Stack Error log:
C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:33
else if (typeof typ === "object" && typ.literal !== undefined) {
^
TypeError: Cannot read properties of null (reading 'literal')
at prettyTypeName (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:33:45)
at prettyTypeName (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:23:35)
at invalidValue (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:15:23)
at transformUnion (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:71:16)
at transform (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:132:15)
at C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:105:32
at Array.forEach (<anonymous>)
at transformObject (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:100:43)
at transform (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:136:23)
at cast (C:\Users\Elysia\Desktop\src\node_modules\.pnpm\[email protected]\node_modules\fotmob\dist\cjs\types\player.js:144:12)
Node.js v22.4.1
Expected Behavior
If I use the ID 1071179 (as in the example), no errors occur. I want it to work normally like some other examples.
Steps To Reproduce
Code test:
import Fotmob from "fotmob";
const fotmob = new Fotmob();
let player = await fotmob.getPlayer("30981") // Lionel Messi
Environment
- OS: Windows 10 x64 (19045.4651)
- Node: 22.4.1
- npm: 10.8.1
Version
2.4.1
Anything else?
It could be because you're using typeof, as typeof null returns object.