-
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
isolatedModules
not supported?
#12599
Comments
isolatedmodules
not supported?isolatedModules
not supported?
|
@bartlomieju I'm trying to enable it not disable it, because it doesn't seem to be enabled In my example, it doesn't warn that there's no |
It is enabled by default: Line 156 in 85a2943
Why would it warn that there's no |
This is what I would expect to see if if isolatedModules was enabled. |
I see, this diagnostic is actually supressed in Deno: deno/cli/tsc/99_main_compiler.js Lines 143 to 146 in 85a2943
@kitsonk will have more context on that |
As the commen states, we ignore the diagnostic. What issue is that causing? |
@kitsonk the issue is that when an i think it's odd/confusing that |
@DetachHead That is tracked in #9593. It's an acknowledged issue on TypeScript's side which is less of a design limitation and more of a technical one microsoft/TypeScript#18232 (comment). They want to fix it. I wouldn't say warning against that case is a pivotal role of
What do you mean it fails at runtime? This issue for Deno results in sometimes getting bogus diagnostics and symbol conflicts when type-checking, as far as we know. Are you getting some kind of emit bug as well? |
Correct. All the runtime code we are aware of works properly. The only "problem" is that if you have more than one file open in the editor that aren't considered "modules" their symbols "conflict", and you can get misleading diagnostics that say there is a problem when there isn't a problem (or you think you have access to variables that you don't). Real world modules that don't have any exports or imports that are run under Deno are pretty rare in the wild. Generated bundles might be an exception, but most people don't develop on generated bundles. If we stopped suppressing the diagnostics produced by isolated modules, people who do run single file modules with no imports or exports would break, and if we surfaced it in the language server, it would be more confusing than helpful. #10484 is a suggestion that would produce a useful diagnostic and code action in the language server, but we would still want to suppress such things from the CLI. |
the issue i had is that in the following example: //main.ts
console.log(foo) //foo.ts
const foo = 1 the language server incorrectly assumes what i didn't realise is that this problem seems to only be specific to the language server, and when you actually run it the check correctly identifies that
but i don't understand why the language server behaves differently here? is that not just as much a source of confusion?
in this case, i think @KotlinIsland's suggestion of injecting |
Because the language server subtly differs in how it determines the scope of a program, because the "root" module of a project is ambigious to a language server, as we don't express a The discussion in #10484 stands and we should continue any discussion there. |
i see several merged PRs that seem to have enabled
isolatedModules
by default (#7327, #8050), but that doesn't seem to be the case?no error when running
deno run test.ts
, and when specifying the compiler option explicitly, it gets ignored:The text was updated successfully, but these errors were encountered: