Skip to content

CRA2 doesn't work with reflect-metadata package #6388

Open
@elderapo

Description

@elderapo

Is this a bug report?

Yes

Did you try recovering your dependencies?

No

Which terms did you search for in User Guide?

None

Environment

Environment Info:

  System:
    OS: Linux 4.4 Ubuntu 14.04.5 LTS, Trusty Tahr
    CPU: x64 Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
  Binaries:
    Node: 9.11.2 - /usr/local/bin/node
    Yarn: 1.6.0 - ~/.yarn/bin/yarn
    npm: 5.6.0 - ~/.npm-global/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 64.0
  npmPackages:
    @types/react: ^16.8.2 => 16.8.2 
    @types/react-dom: ^16.8.0 => 16.8.0 
    react: ^16.8.1 => 16.8.1 
    react-dom: ^16.8.1 => 16.8.1 
    react-scripts: 2.1.3 => 2.1.3 
  npmGlobalPackages:
    create-react-app: 1.5.2

Steps to Reproduce

Just follow the steps from the Reproducible Demo part and open console in browser.

Expected Behavior

Browsers console should print someProperty type: Number.

Actual Behavior

It prints couldn't get the type :(.

Reproducible Demo

git clone git@github.com:elderapo/cra2-reflect-metadata-bug.git
cd cra2-reflect-metadata-bug
yarn
yarn start

The problem

I think the problem is that babel completely strips out TS types before compilation process which makes it impossible for reflect-metadata package to do its work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions