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 nyxi
Clone the repo and install the needed dependencies for all the packages by following these steps:
git clone https://github.com/nyxblabs/typescript-wizard.git
cd typescript-wizard
nyxr 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 use our template by creating a new file at the appropriate location, such as
packages/engine/errors/en/<code>.md
orpackages/engine/errors/de/<code>.md
. The template should contain placeholders on how the explanation should be written.
nyxr translate <code> en
nyxr translate <code> de
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'.
I would mention the ability to create new languages and how to do it in the following section:
We welcome contributions to translate TypeScript error messages into new languages. If you would like to add support for a new language, follow these steps:
- Create a new folder under
packages/engine/errors
with the appropriate language code (e.g.,fr
for French). - Inside the new language folder, create a translation file for each error using the error code as the file name (e.g.,
<code>.md
). - Translate the error messages into the target language, following the Translation Style Guide mentioned above.
- Submit a pull request with your new language translations.
With your help, we can make TypeScript error messages accessible to developers around the world. Thank you for your contribution!