denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.9k stars 5.22k forks source link

File with just `+` does not report syntax error #24617

Open lucacasonato opened 1 month ago

lucacasonato commented 1 month ago

Create a file main.ts.

+

Then run deno info main.ts

No diagnostic is raised.

Change the file to:

a+

Running deno info main.ts now:

error: The module's source code could not be parsed: Expression expected at file:///home/lucacasonato/Downloads/publishing_tasks_903afdc4-681b-403c-bc23-1768af7eaad9/index.ts:1:2

  a+
   ~
lucacasonato commented 1 month ago

Same issue with:

void
dsherret commented 1 month ago

This is by design. Certain diagnostics are only surfaced when transpiling:

> deno run main.ts 
error: Expression expected at file:///V:/scratch/main.ts:1:1

  +
  ~
dsherret commented 1 month ago

The main reason for this issue was resolved in https://github.com/denoland/deno/pull/24620

Maybe we should close this one?