[BUG]: Unable to compile with Typescript.
Closed this issue ยท 24 comments
I have been attempting to integrate Openblox into a project of mine, but on compile I run into this error:
RangeError: Maximum call stack size exceeded
at resolveNameHelper (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:18946:29)
at resolveEntityName (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:47862:32)
at getSymbolOfNameOrPropertyAccessExpression (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:84521:22)
at getSymbolAtLocation (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:84631:18)
at getTypeFromTypeNodeWorker (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:61238:24)
at containsReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:61481:101)
at visitNode2 (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:27329:18)
at forEachChildInTypeReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:27435:12)
at forEachChild (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:27850:35)
at containsReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\typescript@5.5.4\node_modules\typescript\lib\tsc.js:61504:16)
To make sure that this was not something happening on my end, I set up a very bare-bones Typescript project to test and make sure that it was a consistent issue. Adding on, it only seems to run into this error when something is being imported with Openblox; removing any imports relating to it, it runs into no issue.
You can find the test code I used here.
Hey, sorry I didn't this issue until now, my apologies. I can indeed reproduce this issue and will try and resolve it. As an alternative until then you can see if adding skipLibCheck
to your compiler options helps.
Adding skipLibCheck
does indeed work from what I've tested. Thanks for the response, excited to integrate this into things ๐ค
I think i'm going to close this issue for now then ๐ .
From an initial look it seems that not having skipLibCheck
causes more issues than the one you described above, specifically with Bun's types colliding with Node's. So I think this may be an issue with Bun but i'm unsure at this point in time. ๐
I pray that this can be resolved sometime soon ๐๐ผ I'm running into an issue with skibLibCheck
, types will not work as intended in .d.ts
files, which makes it a bit harder for me to properly typeset things.
What about the .d.ts
files is not working as intended?
What about the
.d.ts
files is not working as intended?
In specific, it won't properly resolve types. Anything for the package that is defined gets resolved as "any".
I did some searching and I believe the culprit is some circular dependency in one of the .d.ts files
I was going to try debugging the issue and open a PR, though I couldn't figure out how to properly build source ๐
It honestly might be the fact that type files are named .types.ts rather than .d.ts
Edit: Actually not sure, since the build code (from npmjs) seems fine
@sqikerz .d.ts
files are created during a build step and our only present in the dist folder.
the .types.ts
naming scheme is arbitrary and is used to denote that said typescript file is used for types only. It should not interfere with .d.ts files.
I was going to try debugging the issue and open a PR, though I couldn't figure out how to properly build source ๐
That seems interesting. From my testing it seems that the issue is with the apis
folder.
Also to build the code run npm run build:code
.
What about the
.d.ts
files is not working as intended?In specific, it won't properly resolve types. Anything for the package that is defined gets resolved as "any".
Which version is this happening in?
What about the
.d.ts
files is not working as intended?In specific, it won't properly resolve types. Anything for the package that is defined gets resolved as "any".
Which version is this happening in?
Version for what in specific?
Made some modifications (mainly verbose, and not using bun/ts at all in the build process), and I got this:
Seems like a known issue, node and bun types are conflicting - oven-sh/bun#8761
I was going to try debugging the issue and open a PR, though I couldn't figure out how to properly build source ๐
That seems interesting. From my testing it seems that the issue is with the
apis
folder.Also to build the code run
npm run build:code
.
Yea I did try this, but I get this error:
> openblox@1.0.23 build:code
> delete dist && bun run ./build.ts && tsc --emitDeclarationOnly
'delete' is not recognized as an internal or external command,
operable program or batch file.
EDIT: Also pulled latest, forgot to do that, still occurs though.
It seems you are missing the delete-cli
dependency.
bun i delete-cli
Thanks! Though, running into this issue now for some reason? I ran the install script so I have all of the modules installed.
src/http/httpHandler/httpHandler.ts:3:27 - error TS2307: Cannot find module 'roblox-bat' or its corresponding type declarations.
3 import { HBAClient } from "roblox-bat"
~~~~~~~~~~~~
src/queries/cloud/usersQuery.ts:16:35 - error TS2344: Type 'readonly ["createTime", "id", "name", "displayName", "about", "locale", "premium", "idVerified", "socialNetworkProfiles"]' does not satisfy the constraint 'any[]'.
The type 'readonly ["createTime", "id", "name", "displayName", "about", "locale", "premium", "idVerified", "socialNetworkProfiles"]' is 'readonly' and cannot be assigned to the mutable type 'any[]'.
16 type UserInfoField = ArrayToUnion<typeof userInfoFields>
~~~~~~~~~~~~~~~~~~~~~
Found 2 errors in 2 files.
Errors Files
1 src/http/httpHandler/httpHandler.ts:3
1 src/queries/cloud/usersQuery.ts:16
You can remove that line, not sure why its there - I thought i removed it ๐ .
@LuckFire You should now be able to compile your typescript project without skipLibCheck
in openblox 1.0.29
.
(Make sure you have the devDependencies installed) .
Sorry for the late reply, it does compile somewhat now, but on the latest version it seems like there's still some issues.
I can't import UserRestrictionsApi
anymore and when I do compile, I run into this error:
node_modules/.pnpm/openblox@1.0.38_typescript@5.4.5/node_modules/openblox/dist/apis/cloud/index.d.ts:1:28 - error TS2307: Cannot find module './assets' or its corresponding type declarations.
1 export * as AssetsApi from "./assets";
If you need me to, I will make a separate issue about this.
It looks like some exports were missing from ./apis/cloud/index.ts
- no idea how that happened ๐
. Anyways should be fixed now, let me know if you are still running into issues.
Only issue I'm running into now is the failing export for AssetsApi
when the project is built
Ok should be fixed now. It turns out the .npmignore
file was ignoring any folder called assets
instead of just the assets
folder at the root of the project. ๐
My apologies for the bother. ๐
No worries, I appreciate you resolving all of these issues (especially so quickly)! Everything seems to build flawlessly now, any future issues I have I'll create a separate issue for instead of commenting under this one again.
Again, I really appreciate the help ๐๐ผ super excited to use this package