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

SDK Does not Pass the Typechecker #2848

Open
4 tasks done
dairyisscary opened this issue Feb 26, 2024 · 2 comments
Open
4 tasks done

SDK Does not Pass the Typechecker #2848

dairyisscary opened this issue Feb 26, 2024 · 2 comments

Comments

@dairyisscary
Copy link

What happened and what did you expect to happen?

The file node_modules/amazon-chime-sdk-js/build/signalingprotocol/SignalingProtocol.d.ts does not pass typescript typechecker. I have elided the output but there are 22 instances of this same error:

node_modules/amazon-chime-sdk-js/build/signalingprotocol/SignalingProtocol.d.ts:7:26 - error TS2709: Cannot use namespace 'Long' as a type.

7     timestampMs: (number|Long);
                           ~~~~

node_modules/amazon-chime-sdk-js/build/signalingprotocol/SignalingProtocol.d.ts:89:33 - error TS2709: Cannot use namespace 'Long' as a type.

89     public timestampMs: (number|Long);
                                   ~~~~

Versions:

yarn why -R long
   └─ amazon-chime-sdk-js@npm:3.20.0 (via npm:^3.20.0)
      └─ protobufjs@npm:7.2.6 (via npm:^7.2.4)
         └─ long@npm:5.2.3 (via npm:^5.0.0)

yarn info typescript
└─ typescript@patch:typescript@npm%3A5.3.3#optional!builtin<compat/typescript>::version=5.3.3&hash=e012d7
   ├─ Version: 5.3.3

skipLibCheck is false in my project

I did a manual patch of SignalingProtocol.d.ts to change and it seems to compile

-import Long = require("long");
+import type Long from "long";

Have you reviewed our existing documentation?

Reproduction steps

yarn run tsc as a downstream project that checks libs with "skipLibCheck": false in one's tsconfig.json

Amazon Chime SDK for JavaScript version

posted above

What browsers are you seeing the problem on?

n/a

Browser version

n/a

Meeting and Attendee ID Information.

No response

Browser console logs

n/a

@ltrung
Copy link
Contributor

ltrung commented Mar 12, 2024

What typescript version are you using?

@dairyisscary
Copy link
Author

dairyisscary commented Mar 12, 2024

As specificed in the original issue, this was produced in typescript version 5.3.3, though it still appears to be the case in 5.4.x.

I have made a minmalist reproduction with a replit here: https://replit.com/@dairyisscary/Aws-sdk-reproduction?v=1#tsconfig.json

i think that some combination of the tsconfig.json configuration options module, moduleResolution and of course, skipLibCheck: false are what make the semantics of this particular line import Long = require("long"); invalid here. 🤷

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

2 participants