Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Unable to compile with Typescript. #4

Closed
LuckFire opened this issue Jul 22, 2024 · 24 comments
Closed

[BUG]: Unable to compile with Typescript. #4

LuckFire opened this issue Jul 22, 2024 · 24 comments

Comments

@LuckFire
Copy link

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\[email protected]\node_modules\typescript\lib\tsc.js:18946:29)
    at resolveEntityName (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:47862:32)
    at getSymbolOfNameOrPropertyAccessExpression (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:84521:22)
    at getSymbolAtLocation (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:84631:18)
    at getTypeFromTypeNodeWorker (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:61238:24)
    at containsReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:61481:101)
    at visitNode2 (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:27329:18)
    at forEachChildInTypeReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:27435:12)
    at forEachChild (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsc.js:27850:35)
    at containsReference (C:\Users\Colt\Desktop\test-proj\node_modules\.pnpm\[email protected]\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.

@cameronpcampbell
Copy link
Owner

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.

@LuckFire
Copy link
Author

Adding skipLibCheck does indeed work from what I've tested. Thanks for the response, excited to integrate this into things 🤞

@cameronpcampbell
Copy link
Owner

cameronpcampbell commented Jul 27, 2024

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. 😅

@LuckFire
Copy link
Author

LuckFire commented Aug 4, 2024

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.

@cameronpcampbell
Copy link
Owner

What about the .d.ts files is not working as intended?

@LuckFire
Copy link
Author

LuckFire commented Aug 5, 2024

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".

@sqikerz
Copy link
Contributor

sqikerz commented Aug 5, 2024

I did some searching and I believe the culprit is some circular dependency in one of the .d.ts files

@LuckFire
Copy link
Author

LuckFire commented Aug 5, 2024

I was going to try debugging the issue and open a PR, though I couldn't figure out how to properly build source 😅

@sqikerz
Copy link
Contributor

sqikerz commented Aug 5, 2024

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

@cameronpcampbell
Copy link
Owner

cameronpcampbell commented Aug 5, 2024

@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.

@cameronpcampbell
Copy link
Owner

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.

@cameronpcampbell
Copy link
Owner

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?

@LuckFire
Copy link
Author

LuckFire commented Aug 5, 2024

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?

@sqikerz
Copy link
Contributor

sqikerz commented Aug 5, 2024

Made some modifications (mainly verbose, and not using bun/ts at all in the build process), and I got this:
image

Seems like a known issue, node and bun types are conflicting - oven-sh/bun#8761

@LuckFire
Copy link
Author

LuckFire commented Aug 5, 2024

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:

> [email protected] 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.

@cameronpcampbell
Copy link
Owner

It seems you are missing the delete-cli dependency.

bun i delete-cli

@LuckFire
Copy link
Author

LuckFire commented Aug 5, 2024

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

@cameronpcampbell
Copy link
Owner

You can remove that line, not sure why its there - I thought i removed it 😅.

@cameronpcampbell
Copy link
Owner

@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) .

@LuckFire
Copy link
Author

LuckFire commented Aug 15, 2024

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.

@cameronpcampbell
Copy link
Owner

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.

@LuckFire
Copy link
Author

LuckFire commented Aug 15, 2024

Only issue I'm running into now is the failing export for AssetsApi when the project is built

@cameronpcampbell
Copy link
Owner

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. 😅

@LuckFire
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants