Skip to content

Make compatible with --isolatedModules TypeScript flag #54

@rivertam

Description

@rivertam

Describe the bug

When doing nothing but importing the project as such:

import Unity, { UnityContent } from 'react-unity-webgl';

TypeScript with the isolatedModules flag gives the error:

Type error: Cannot re-export a type when the '--isolatedModules' flag is pr
ovided.  TS1205

    4 | import { UnityVersion } from "./enums/UnityVersion";
    5 |
  > 6 | export { IUnityConfig, UnityContent, UnityVersion };
      |          ^
    7 | export default Unity;
    8 |

To Reproduce
I can make detailed reproduction steps, but I don't think it's necessary in this instance.

Expected behavior
I expect at least for it to build. =)

Desktop (please complete the following information):

  • OS: Linux
  • Browser: N/A (Node @ 10.2.1, TypeScript @ 3.2.2)
  • Version: 7.07 on npm

Additional context
Hello! I know this is not truly a bug, but Create React App with the default TypeScript options actually does not seem to allow you to turn this flag off, so this module is unusable in CRA with TypeScript. It's not that big of a deal, but I suspect it's a quick fix. I will look into fixing it myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleInactive for too long

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions