#How to generate tsconfig file without installing typescript? With npx?
8 messages · Page 1 of 1 (latest)
I think you might have misunderstood something here, tsc itself is not deprecated, only the tsc npm package, so you dont have to install both tsc and typescript package.
Just install typescript, then you can use tsc
check out the typescript install page, they describe it there a bit: https://www.typescriptlang.org/download
Add TypeScript to your project, or install TypeScript globally
So there is no way to generate tsc config with npx?
Seems official docs recommending deprecating package
@edgy hill @raven brook thing is,
the tsc npm package has been deprecated for ages
the package you need to install/use for typescript is called typescript
but the executable provided by the typescript package is called tsc
so, since the name of the executable is different from the name of the package, you need to use the -p option when using npx
it allows the specify what package to run the command against
final result is npx -p typescript tsc --init
https://docs.npmjs.com/cli/v9/commands/npx
The
-pargument is a shorthand for--parseablein npm, but shorthand for--packagein npx. This is maintained, but only for the npx executable.
no because in that example, they are invoking the tsc executable after installing the typescript package locally (or globvally), which then works
@rustic moon reputation +1 🙂