Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript code collections #1121

Open
almostSouji opened this issue May 17, 2022 · 4 comments · May be fixed by #1560
Open

Typescript code collections #1121

almostSouji opened this issue May 17, 2022 · 4 comments · May be fixed by #1560
Labels
meta: roadmap Planned t: request Suggestion to add new or change existing content

Comments

@almostSouji
Copy link
Member

almostSouji commented May 17, 2022

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

@almostSouji almostSouji added the t: request Suggestion to add new or change existing content label May 17, 2022
@almostSouji almostSouji changed the title Typescript code choices Typescript code collections May 17, 2022
@almostSouji almostSouji added the meta: roadmap Planned label May 27, 2022
@bchilcott
Copy link

bchilcott commented Apr 22, 2023

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.`
  );
}

@monbrey
Copy link
Member

monbrey commented Apr 22, 2023

There's nothing wrong with this, nor should it be avoided in JavaScript code.

We are also going to support TypeScript though

@bchilcott
Copy link

@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.

@almostSouji
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: roadmap Planned t: request Suggestion to add new or change existing content
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants