Why react CLI does not installing template as typescript?

Viewed 95

After running npm init react-app new-app --template typescript it simply creates a javascript template project, not typescript. I want to create a typescript project using CLI.

Node JS version: 15.9.0
NPM version: 7.0.15

1 Answers

Per the docs, in NPM v7:

Any additional options will be passed directly to the command, so npm init foo -- --hello will map to npx create-foo --hello.

This is subtly different to v6, where:

Any additional options will be passed directly to the command, so npm init foo --hello will map to npx create-foo --hello.

Note the additional -- for v7, which in your case would be:

npm init react-app -- new-app --template typescript
Related