@ types / youtube + create-react-app + TypeScript =提供'--isolatedModules'标志后,无法访问环境const枚举

时间:2019-11-05 06:40:10

标签: typescript

我正在使用create-react-app和typescript和@ types / youtube进行开发。

当我在代码YT.PlayerState.PLAYING上键入此行时。

我收到TypeScript错误Cannot access ambient const enums when the '--isolatedModules' flag is provided.

我看看打字:

declare namespace YT
{
    /**
     * State of a video player.
     */
    export const enum PlayerState
    {
        UNSTARTED = -1,
        ENDED = 0,
        PLAYING = 1,
        PAUSED = 2,
        BUFFERING = 3,
        CUED = 5
    }
...

如何在不将标志isolatedModules设置为false的情况下解决此问题?

0 个答案:

没有答案