Skip to content

decorators on generator functions parse error with --typescript #6680

Open
@wangtao0101

Description

Is this a bug report?

(write your answer here)
Yes

Did you try recovering your dependencies?

(Write your answer here.)
npm --version
6.4.1

Which terms did you search for in User Guide?

(Write your answer here if relevant.)
decorators on generator functions parse error with --typescript

Environment

(paste the output of the command here)

Environment Info:

System:
OS: Windows 10
CPU: x64 Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
Binaries:
Yarn: 1.10.1 - C:\Program Files\nodejs\yarn.CMD
npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
Internet Explorer: 11.0.17134.1
npmPackages:
react: ^16.8.4 => 16.8.4
react-dom: ^16.8.4 => 16.8.4
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

  1. create-react-app my-app typescript
  2. add experimentalDecorators in tsconfig.json
  3. add related code
@effect() // define async action handle
    * addAsync(count: number) {
        yield delay(2000);
        this.add(count); // type check here
    }

Expected Behavior

(Write what you thought would happen.)

parse success

Actual Behavior

(Write what happened. Please add screenshots!)

./src/AppModel.ts
SyntaxError: C:\Users\zeroone\Desktop\my-app\src\AppModel.ts: Unexpected token (17:30)

  15 | export default class AppModel extends Model<AppState> {
  16 |     @effect() // define async action handle
> 17 |     * addAsync(count: number) {
     |                               ^
  18 |         yield delay(2000);
  19 |         this.add(count); // type check here
  20 |     }

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions