-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Remove type checking for unanalysable dynamic imports #14877
Labels
tsc
related to the TypeScript tsc compiler
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
kitsonk
added
suggestion
suggestions for new features (yet to be agreed)
tsc
related to the TypeScript tsc compiler
and removed
stale
labels
Sep 16, 2022
We should do this. It will also cause problems for no-slow-types in JSR. |
dsherret
added
enhancement
and removed
suggestion
suggestions for new features (yet to be agreed)
labels
Feb 25, 2024
dsherret
added a commit
that referenced
this issue
Mar 13, 2024
In addition to the reasons for this outlined by @nayeemrmn in #14877 (which I think are reasons alone to not do this), this simplifies things a lot because then we don't need to implement the following: 1. Need to handle a JSR module dynamically importing a module within it. 2. Need to handle importing an export of a JSR dep then another export dynamically loaded later. Additionally, people should be running `deno check dynamic_import.ts` instead of relying on this behaviour. Landing this as a fix because it's blocking people in some scenarios and the current behaviour is broken (I didn't even have to change any tests to remove this, which is bad). Closes #22852 Closes #14877 Closes #22580
nathanwhit
pushed a commit
that referenced
this issue
Mar 14, 2024
In addition to the reasons for this outlined by @nayeemrmn in #14877 (which I think are reasons alone to not do this), this simplifies things a lot because then we don't need to implement the following: 1. Need to handle a JSR module dynamically importing a module within it. 2. Need to handle importing an export of a JSR dep then another export dynamically loaded later. Additionally, people should be running `deno check dynamic_import.ts` instead of relying on this behaviour. Landing this as a fix because it's blocking people in some scenarios and the current behaviour is broken (I didn't even have to change any tests to remove this, which is bad). Closes #22852 Closes #14877 Closes #22580
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For dynamic imports with non-static-string specifiers like
await import("./" + "foo.ts")
, we do a separate type check at runtime with the imported module as the root. Users write these when importing a directory of modules or something. I propose to no longer type check these, for the following reasons:deno check
or your editor, and not checking duringdeno run
. That already aligns with the proposed behaviour. The only way then to type check these truly dynamic imports isdeno run --check
, which is an awkward discrepancy. So I think we shouldn't do it then either.dynamic_imports.ts
(maybe auto-generated by scanning a directory) which tracks such imports and is checked statically in CI:deno check main.ts dynamic_imports.ts
.Note that points 1 and 2 apply to web workers as well, but let's leave those out of scope for now. Eventually I think we should do the same thing for them and introduce
deno check --worker
.The text was updated successfully, but these errors were encountered: