-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
In JS, assertions imported via commonjs have bogus error #38379
Comments
Repros since 3.7, when we introduced asserts. |
My hot take is that this is a bogus error almost everywhere you could get it... |
I ran into this today when updating I fixed this with /** @type {import('assert')} */
const assert = require('assert') Is it possible for the type definition of |
The problem is that symbols imported via |
I prototyped a solution at the branch alias-for-require. It fixes this example, but is woefully incomplete everywhere else. It still needs:
@weswigham you might be interested in this. |
Code
Expected behavior:
No error.
Actual behavior:
Error: "Assertions require every name in the call target to be declared with an explicit type annotation."
There is no error when using ES imports:
The text was updated successfully, but these errors were encountered: