parcel-plugin-typescript icon indicating copy to clipboard operation
parcel-plugin-typescript copied to clipboard

ts type alias fails with Parcel but works with tsc

Open mverleg opened this issue 6 years ago • 1 comments

(I originally reported this at Parcel, but it seems it might be related to this plugin, so I'm moving it here)

🐛 bug report

Compiling the MWE (involving type) fails with Parcel

:paintbrush: HTML

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"></head>
<body>
<script src="core.ts"></script>
</body>
</html>

:coffee: TS

type Cb = () => void;
let q: Cb = () => { console.log('hello') };

🎛 Configuration (.babelrc, package.json, cli command)

"parcel-bundler": "^1.11.0",
"parcel-plugin-typescript": "^1.0.0",
"sass": "^1.15.3",
"typescript": "^3.2.2",
"minimatch": "3.0.4"

🤔 Expected Behavior

The example compiles fine, the way it does when using tsc core.ts

😯 Current Behavior

$ parcel index.html
🚨  /home/mark/benjamin-jsclient/MWE/core.ts:2:9: Unexpected token, expected ";" (2:9)
  1 | 
> 2 |     type Cb = () => void;
    |         ^
  3 |     let q: Cb = () => { console.log('hello') };

mverleg avatar Jan 26 '19 09:01 mverleg

I confirm as of April 2020 I'm getting the same issue on a type alias, where it reports Unexpected token, expected ";". Sad that there hasn't been any improvement in this area. Seems like there are a lot of other issues which are different but similar complaints which are not getting any attention.

uglycoyote avatar Apr 17 '20 18:04 uglycoyote