Skip to content

Cannot compile code using abstract construct signatures (typescript 4.2) #10979

Description

@christopherswenson

react-scripts with the cra-template-typescript does not seem to support some features of typescript 4.2. Specifically I get an error when using abstract construct signatures.

Does react-scripts just not support typescript 4.2 yet?

Reproduce

  1. yarn create react-app ts42test --template typescript
  2. Change typescript version in package.json to ^4.2.4
  3. Add type Constructor<T = {}> = abstract new (...args: any[]) => T; somewhere
  4. yarn start
./src/App.tsx
SyntaxError: /ts42test/src/App.tsx: Missing semicolon (5:35)

  3 | import './App.css';
  4 |
> 5 | type Constructor<T = {}> = abstract new (...args: any[]) => T;
    |                                    ^
  6 |
  7 | function App() {
  8 |   return (

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions