Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !6931

Adds TSC_COMPILE_ON_ERROR env var...

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/kylebebak/master into master Apr 26, 2019
  • Overview 29
  • Commits 7
  • Pipelines 0
  • Changes 6

Created by: kylebebak

Closes #6930 (closed).

Allows users to run and properly build TypeScript projects even if there are TypeScript type check errors.

Motivation and discussion in this issue.

I know it works because I took the react-scripts and react-dev-utils deps from the create-react-app monorepo, edited them with the same changes that are in this PR, and put them in my own repos.

To test it out, you can just create a bare TypeScript app with npx create-react-app cra-typescript --typescript, then change the react-scripts dep as follows.

{
  "name": "cra-typescript",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/jest": "24.0.11",
    "@types/node": "11.13.7",
    "@types/react": "16.8.14",
    "@types/react-dom": "16.8.4",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "fortana-co/react-scripts#master",
    "typescript": "3.4.5"
  },
  "scripts": {
    "start": "echo 'REACT_APP_ENV=dev\nTSC_COMPILE_ON_ERROR=true' > .env && react-scripts start",
    "build": "echo 'REACT_APP_ENV=prod\nTSC_COMPILE_ON_ERROR=true' > .env && react-scripts build",
    "build-stg": "echo 'REACT_APP_ENV=stg\nTSC_COMPILE_ON_ERROR=true' > .env && react-scripts build",
    "test": "react-scripts test --env=jsdom --modulePaths=src",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

After this you'll be be able to run npm start and npm run build successfully, even if there are type errors. These type errors are printed to the terminal and the browser console.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/kylebebak/master