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.
- Node.js version installed, latest LTS is recommended
- Install pnpm
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
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 formattingerror 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>
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.
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.
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'.