Using TypeScript
Use Nokkio's built-in types to catch errors earlier
If you prefer to write your React project in TypeScript, Nokkio is setup to use types out of the box. Just create your project using the --typescript flag:
nokkio create my-ts-project --typescript
Type checking before deploys
By default, Nokkio's compiler strips types at compile time. This means that a type error would not stop a deploy from proceeding. If you would prefer to only deploy when all type-checks pass, add a nokkio:ci script to our package.json file:
"scripts": {
"nokkio:ci": "tsc"
}
If you use TypeScript in your Nokkio Endpoints, use the nokkio typecheck-server command to validate that your server code is free of type errors before deploying:
"scripts": {
"nokkio:ci": "tsc && nokkio typecheck-server"
}