- (Emphasis) When trying to configure
ts-node
as mentioned, I continuously encountered insurmountable errors that required about two hours of troubleshooting. - I set up the project using
tsx
to ensure that others do not face similar issues and can execute the configuration smoothly.
- Utilizes TypeScript by default.
- Allows the use of
await
at the top-level of the code (outside functions). - Operates based on ESNext standards for TypeScript.
- Enables writing code in the style of
import ~ from "./util.ts"
(similar to Python). - Offers the benefit of using
await
at the top-level. - Includes ESLint for maintaining code quality and consistency.
Execute the following command to run main.ts
located under the src
directory. The code makes a simple request stored inside util
and outputs the result as a string.
npm run main
You can install create-tsready
globally to use it anywhere.
npm install -g create-tsready
Use the following command to create a new project:
npm init tsready my-new-project
This command will create a new directory called my-new-project, copy the TypeScript template files, and install the necessary dependencies.
After creating a new project, the directory structure will be as follows:
my-new-project/
├── src/
│ └── main.ts
├── tsconfig.json
├── .eslintrc.json
├── .eslintignore
└── package.json
- src/main.ts: The main TypeScript entry file.
- tsconfig.json: TypeScript compiler configuration file.
- .eslintrc.json: ESLint configuration file.
- .eslintignore: Files and directories to ignore for ESLint.
- package.json: Project's npm configuration file.
Once the project is set up, you can start it with:
npm run main
To check for code quality and consistency using ESLint, run the following command:
npx eslint src/**/*.ts
To automatically fix issues that can be resolved, run:
npx eslint src/**/*.ts --fix
If you would like to contribute, please submit a PR or open an issue.
This project is licensed under the MIT License. See the LICENSE file for more details.