Open almostSouji opened 2 years ago
I can't believe this has been avoided/delayed for so long - first class typescript support should be the standard now. Especially to avoid things like this:
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(
`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`
);
}
There's nothing wrong with this, nor should it be avoided in JavaScript code.
We are also going to support TypeScript though
@monbrey I'm saying that JavaScript code should be avoided, by pushing TS as the primary/recommended way of doing things in the docs. That way nobody needs to worry about checking for key names on arbitrary objects.
I get that it can be seen as personal preference, but ultimately the docs should be recommending best practices and type safety, and giving the option for JS. Not the other way around.
JS is a valid programming language, and often the default for beginners. It is not easy to wrap your head around types when you are starting out, which a large portion of our user base is. Thank you for your concern, but we will stick to JS as a main language for the guide and consider including TypeScript examples or variants where appropriate.
Is your feature request related to a problem? Please describe.
Some concepts covered in the guide require more attention when using typescript.
Describe the solution you'd like
Toplevel code block collection (above files/in navbar setting) to provide both js and ts code samples
Describe alternatives you've considered
Use the current code block collection element to cover typescript versions of code samples
Additional notes
n/a