TypeScript
Redwood comes with full TypeScript support, and you don't have to give up any of the conveniences that Redwood offers to enjoy all the benefits of a type-safe codebase.
Starting a Redwood Project in TypeScript
You can use the --typescript
option on yarn create redwood-app
to use TypeScript from the get-go:
yarn create redwood-app my-redwood-app --typescript
Converting a JavaScript Project to TypeScript
Started your project in JavaScript but want to switch to TypeScript?
Start by using the tsconfig
setup command:
yarn rw setup tsconfig
This adds tsconfig.json
files to both the web and the api side, telling VSCode that this's a TypeScript project.
(You can go ahead and remove the jsconfig.json
files in both sides now.)
You don't need to convert all your JavaScript files to TypeScript right away.
In fact, you probably shouldn't.
Do it incrementally.
Start by renaming your files from .js
to .ts
, or, if they have a React component, .tsx
.