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

Cannot use DebugEngine with Typescript #337

Open
koukalp opened this issue Sep 19, 2019 · 3 comments
Open

Cannot use DebugEngine with Typescript #337

koukalp opened this issue Sep 19, 2019 · 3 comments

Comments

@koukalp
Copy link

koukalp commented Sep 19, 2019

I am following the documentation when setting up this awesome library with React and Typescript.

  1. Import the dependencies:
import {Provider as StyletronProvider, DebugEngine} from "styletron-react";
  1. init the debugger:
const debug = process.env.NODE_ENV === "production" ? void 0 : new DebugEngine();
  1. Typescript gives a warning on the new DebugEngine()
    image

  2. in step 1, import BrowserDebugEngine instead:

import {BrowserDebugEngine,Provider as StyletronProvider} from "styletron-react";
  1. use it in step 2:
const debug =process.env.NODE_ENV === "production" ? void 0 : new BrowserDebugEngine();
  1. React app won't load with the following error:
    image

The debug feature would be quite useful. Everything else works flawlessly. Would be great if smbd could give me a hint on how to fix my issue

@choyongjoon
Copy link

I'm using // @ts-ignore to ignore this error.

@koukalp
Copy link
Author

koukalp commented Sep 20, 2019

thanks for answer. That doesn't really fix anything for me:

// @ts-ignore
  process.env.NODE_ENV === "production" ? void 0 : new BrowserDebugEngine();

@chasestarr
Copy link
Contributor

This repo only maintains and publishes flow-types. I suggest sending a PR to DefinitelyTyped if you find it helpful

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

4 participants