Skip to content

Latest commit

 

History

History
77 lines (44 loc) · 2.41 KB

CONTRIBUTING.md

File metadata and controls

77 lines (44 loc) · 2.41 KB

How do I contribute? 💪

We're excited to have you on board!

As you can see from the tsErrorMessages.json, there's a serious amount of work that needs to be done to cover every possible Typescript Error. And that's when the open-source community really shines.

Your contributions will eventually help save countless hours for people struggling with TypeScript error messages.

Prerequisites

  1. Node.js version installed, latest LTS is recommended
  2. Install pnpm

How to start developing?

Clone the repo and install the needed dependencies for all the packages by following these steps:

git clone https://github.com/mattpocock/ts-error-translator.git
cd ts-error-translator
pnpm
pnpm dev # This will run the next app

Adding/editing error translations

You'll find all of the errors' translations at packages/engine/errors and they follow the following conventions:

  • Every file must be named with its error code: <code>.md

💡 Hint: To find the code for the error you're looking for, have a look inside tsErrorMessages.json, or check your console, you'll see this formatting error TS<code>: <msg>.

  • You can follow our template by running the following command. This will write an example file at packages/engine/errors/<code>.md with placeholders on how the explanation should be written.
pnpm run translate <code>

Translation style guide

You are the compiler

Similar to Elm, you should address the user as though you are the compiler.

Bad:

TypeScript thinks that this is a type, not a variable.

Good:

I think that this is a type, not a variable.

Speak to the user directly

In a similar vein, you should address the user directly whenever possible - this keeps it conversational and terse.

Bad:

The code might have an unnecessary trailing comma.

Good:

You might have added an unnecessary trailing comma.

Don't use {0} and {1} in excerpts

Excerpts should always be short and sweet - {0} can expand to enormous size and make even our pretty excerpts unreadable. You can use 'A' and 'B' instead if you like.

Bad:

{0} can't be passed to a slot expecting {1}.

Good:

'A' can't be passed to a slot expecting 'B'.