Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #6680
Closed
Open
Issue created Mar 19, 2019 by Administrator@rootContributor

decorators on generator functions parse error with --typescript

Created by: wangtao0101

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.)

Assignee
Assign to
Time tracking