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

tagged template not imported but not error #405

Closed
KotlinIsland opened this issue Apr 29, 2021 · 4 comments
Closed

tagged template not imported but not error #405

KotlinIsland opened this issue Apr 29, 2021 · 4 comments
Labels
design limitation upstream This feature requires upstream changes

Comments

@KotlinIsland
Copy link

a.ts

function c(a: TemplateStringsArray, ...b: string[]) {}

b.ts

c``

vscode shows now errors but this is invalid code as it's not imported.

@kitsonk kitsonk added the upstream This feature requires upstream changes label Apr 29, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Apr 29, 2021

This is a TypeScript limitation (microsoft/TypeScript#18232) and there is no control Deno or Deno extension has over it. While Deno only deals with ES Modules, the TypeScript type checker will treat files without any imports or exports as conventional scripts, which means they share the same global namespace, just as if you used them as scripts in a browser.

@KotlinIsland
Copy link
Author

@kitsonk Could there be a lint rule that could alert users to this bizarre behaviour?

@kitsonk
Copy link
Contributor

kitsonk commented Apr 29, 2021

I am not sure what the lint rule would be, and it only applies to editing code in an editor, as this won't occur on the CLI, because the CLI only deals with modules.

@KotlinIsland
Copy link
Author

KotlinIsland commented May 3, 2021

Something like "warning, this file doesn't contain any imports/exports and is therefore falsely considered global"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design limitation upstream This feature requires upstream changes
Projects
None yet
Development

No branches or pull requests

2 participants