-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat/typescript: add TypeScript examples to the guide #1560
base: main
Are you sure you want to change the base?
Conversation
Something I was considering is creating an entirely separate TypeScript section in the guide and adding all the guide content there. This has the advantage of keeping the JS portion of the guide clean, but it also essentially duplicates the content |
9844965
to
70cdde9
Compare
import { REST, Routes } from 'discord.js'; | ||
import { Config, assertObjectIsConfig } from './types/Config'; | ||
import fs from 'fs'; | ||
import path from 'path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import path from 'path'; | |
import path from 'node:path'; |
```ts | ||
import { REST, Routes } from 'discord.js'; | ||
import { Config, assertObjectIsConfig } from './types/Config'; | ||
import fs from 'fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import fs from 'fs'; | |
import fs from 'node:fs'; |
::: | ||
:::code-group-item ts | ||
```ts {1-2} | ||
import { readFileSync } from 'fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { readFileSync } from 'fs'; | |
import { readFileSync } from 'node:fs'; |
:::code-group-item ts | ||
```ts {1-2} | ||
import { readFileSync } from 'fs'; | ||
import path from 'path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import path from 'path'; | |
import path from 'node:path'; |
::: code-group-item ts | ||
```ts | ||
import { readFileSync } from 'fs'; | ||
import path from 'path'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import path from 'path'; | |
import path from 'node:path'; |
::: | ||
::: code-group-item ts | ||
```ts | ||
import { readFileSync } from 'fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { readFileSync } from 'fs'; | |
import { readFileSync } from 'node:fs'; |
Maybe eslint section should also include basic information about |
Please describe the changes this PR makes and why it should be merged:
WIP WIP! I'm only opening the PR to get opinions on the current structure and suggestions on how to improve things. The current examples are slightly opinionated, but could possibly stand to be more opinionated on things like the tsconfig.json.
This PR adds TypeScript examples to the guide.
Pages now have TypeScript markdown containers when TypeScript-specific tips need to be displayed. Additionally, TypeScript examples are added to pages using code groups so that guide readers can switch between JS/TS examples on the fly.
Closes #1121