Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create-react-app Typescript error TS1209 #3177

Closed
PD0815 opened this issue Nov 26, 2018 · 1 comment
Closed

Create-react-app Typescript error TS1209 #3177

PD0815 opened this issue Nov 26, 2018 · 1 comment

Comments

@PD0815
Copy link

PD0815 commented Nov 26, 2018

Hello

I'm using create-react-app with TypeScript enabled to build a React App. But when I want to compile the code I'm getting the following error:
Type error: Ambient const enums are not allowed when the '--isolatedModules' flag is provided. TS1209.

Environment

  • blueprintjs/datetime: "^3.3.1"
  • react-scripts: "2.1.1",

Actual behavior

Creating an optimized production build...
Failed to compile.

/usr/src/app/node_modules/@blueprintjs/datetime/lib/esm/common/months.d.ts
Type error: Ambient const enums are not allowed when the '--isolatedModules' flag is provided.  TS1209

     5 |  * easily compared to `date.getMonth()`.
     6 |  */
  >  7 | export declare const enum Months {
       |                           ^
     8 |     JANUARY = 0,
     9 |     FEBRUARY = 1,
    10 |     MARCH = 2,


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1

Possible solution

When I change the following line from
export const enum Months
to
export enum Months
in the node_modules blueprint/packages/datetime/src/common/months.ts
the App compiles correctly.

@giladgray
Copy link
Contributor

huh whoops that should definitely be a regular enum, not a const enum. happy to review a PR @PD0815 👍

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

No branches or pull requests

2 participants