jashkenas / jashkenas/coffeescript

CoffeeScript compiler removes explicit parentheses making casts difficult in JSDoc

Open
#5,418 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
16.6k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#casts

```coffee
b = ###* @type {B} ### (a)
```

Actual:
```js
// Generated by CoffeeScript 2.6.1
var b;

b = /** @type {B} */a;
```

Expected:
```js
// Generated by CoffeeScript 2.6.1
var b;

b = /** @type {B} */ (a);
```

Contributor guide

Open the contributing guide

Research direction

Start by compiling the CoffeeScript reproduction containing the JSDoc @type cast and explicit parentheses, then compare the generated JavaScript with the expected output. Trace the compiler handling of JSDoc comments and parenthesized expressions; done means the parentheses are preserved for this case without regressing ordinary parenthesis removal.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.