Typescript does not error on compilation with create react app

Viewed 2250

I have set up a new project using npx create-react-app my-app --template typescript and I haven't changed any config settings.

If I type some code that has a TS error, my IDE (VS Code) will show the error. However, when I run start/build I do not get any compilation errors.

Further to this, npm run build does fail with the error when run on our GitLab CI/CD pipeline.

I have checked my TS versions, both in the project and where my global module is, both are the same version (4.1.3).

As I said, I haven't made any changes to what create react app has generated and I have tried creating a new project and get the same results. Does anyone have any ideas?

EDIT - To add to this, if I run tsc at the root I get the compilation errors, but npm start I do not.

EDIT 2 - This is my scripts in package.json (untouched from what CRA gives us)

"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
}
1 Answers
Related