create-react-app error import type * as PrettyFormat from './types' in pretty-format

前端 未结 2 1958
南方客
南方客 2021-02-14 02:54

it\'s a fresh install of cra with typescript template running on node 13.11.0 it gives me error when try to run npm start

TypeScript error in D:/Projects/persona         


        
2条回答
  •  一向
    一向 (楼主)
    2021-02-14 03:47

    Actually this "import type" is a new syntax introduced in Typescript 3.8 https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-exports

    The solution is actually very simple (if it's an option for you), just upgrade your typescript to 3.8+

提交回复
热议问题