codemix / babel-plugin-typecheck

Static and runtime type checking for JavaScript in the form of a Babel plugin.
MIT License
886 stars 44 forks source link

Following the README, but can't get it working #176

Closed iroy2000 closed 7 years ago

iroy2000 commented 7 years ago

Here is my .babelrc

{
  "presets": ["es2015", "stage-2"],
  "passPerPreset": true,
  "plugins": [
    ["typecheck", {
      "disable": {
        "production": true
      }
    }, "syntax-flow", "transform-flow-strip-types"]
  ]
}

And here is my package.json

{
  "name": "xxx",
  "version": "0.0.1",
  "description": "yyy",
  "author": "Roy <iroy2000@gmail.com>",
  "scripts": {
    "start": "nodemon src/server.js --watch src --exec babel-node",
    "build": "babel src --copy-files -d dist && cp dist/newrelic.js newrelic.js",
    "serve": "rm -rf dist && npm run build && node dist/server.js",
    "lint": "eslint --fix --format node_modules/eslint-friendly-formatter . --ext .js --ext .jsx  --cache; exit 0"
  },
  "dependencies": {
    "aws-sdk": "^2.5.6",
    "babel-polyfill": "^6.13.0",
    "base64-js": "^1.1.2",
    "body-parser": "^1.15.2",
    "config": "^1.21.0",
    "cookie-parser": "^1.4.3",
    "cors": "^2.7.1",
    "dotenv": "^2.0.0",
    "escape-regexp": "0.0.1",
    "express": "^4.13.3",
    "merge": "^1.2.0",
    "morgan": "^1.7.0",
    "newrelic": "^1.28.3",
    "superagent": "^2.2.0"
  },
  "devDependencies": {
    "babel-cli": "^6.10.1",
    "babel-plugin-syntax-flow": "^6.18.0",
    "babel-plugin-transform-flow-strip-types": "^6.18.0",
    "babel-plugin-typecheck": "^3.9.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-stage-2": "^6.11.0",
    "eslint": "^3.2.2",
    "eslint-config-airbnb": "^10.0.0",
    "eslint-friendly-formatter": "^2.0.6",
    "eslint-plugin-import": "^1.12.0",
    "eslint-plugin-jsx-a11y": "^2.0.1",
    "eslint-plugin-react": "^6.0.0",
    "nodemon": "^1.9.2"
  }
}

And I'm getting a SyntaxError on

SyntaxError: Unexpected token, expected , (8:44)
   6 | const router = new express.Router();
   7 |
>  8 | router.param('jobId', (req, res, next, jobId: string) => {

Am I setup incorrectly?

Thanks for any help.

iroy2000 commented 7 years ago

LOL, find the issues ...