Skip to content

Commit 34ed219

Browse files
committed
update docusaurus
1 parent 345e228 commit 34ed219

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

website/src/pages/index.mdx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,13 @@ import type { MyClass } from 'some-library';
540540
// This ensures only the type is imported and no runtime code from "some-library" ends up in the bundle.
541541
```
542542
543-
### Services
543+
### Services & Types Generation
544544
545-
Documentation becomes outdated the moment it's written, and worse than no documentation is wrong documentation. The same applies to types when describing the modules your app interacts with, such as APIs, messaging systems, databases etc.
545+
Documentation becomes outdated the moment it's written, and worse than no documentation is wrong documentation. The same applies to types when describing the modules your app interacts with, such as APIs, messaging protocols and databases.
546546
547-
For external API services, such as REST, GraphQL etc. it's crucial to generate types from their contracts, whether they use Swagger, schemas, or other sources (e.g. [openapi-ts](https://github.com/drwpow/openapi-typescript), [graphql-config](https://github.com/kamilkisiela/graphql-config) etc.). Avoid manually declaring and maintaining types, as they can easily fall out of sync.
547+
For external services, such as REST, GraphQL, and MQ it's crucial to generate types from their contracts, whether they use Swagger, schemas, or other sources (e.g. [openapi-ts](https://github.com/drwpow/openapi-typescript), [graphql-config](https://github.com/kamilkisiela/graphql-config)). Avoid manually declaring and maintaining types, as they can easily fall out of sync.
548548
549-
As an exception manually declare types only when there is truly no documentation provided by external service.
549+
As an exception, only manually declare types when no options are available, such as when there is no documentation for the service, data cannot be fetched to retrieve a contract, or the database cannot be accessed to infer types.
550550
551551
## Functions
552552
@@ -1070,6 +1070,8 @@ const { fontSizes } = useTheme();
10701070
10711071
### Comments
10721072
1073+
Comments can quickly become outdated, leading to confusion rather than clarity.
1074+
10731075
Favor expressive code over comments by using meaningful names and clear logic. Comments should primarily explain "why," not "what" or "how."
10741076
10751077
Use comments when:
@@ -1089,10 +1091,12 @@ const SECONDS_IN_MINUTE = 60;
10891091
const minutes = seconds * SECONDS_IN_MINUTE;
10901092
const averageUsersPerMinute = noOfUsers / minutes;
10911093

1092-
// ✅ Use - Add context to explain why
1094+
// ✅ Use - Reference planned improvements
10931095
// TODO: Move filtering to the backend once API v2 is released.
10941096
// Issue/PR - https://github.com/foo/repo/pulls/55124
10951097
const filteredUsers = frontendFiltering(selectedUsers);
1098+
1099+
// ✅ Use - Add context to explain why
10961100
// Use Fourier transformation to minimize information loss - https://github.com/dntj/jsfft#usage
10971101
const frequencies = signal.FFT();
10981102
```
@@ -1302,7 +1306,16 @@ type StatusError = {
13021306
// Discriminated union 'StatusProps' ensures predictable component props with no optionals
13031307
type StatusProps = StatusSuccess | StatusLoading | StatusError;
13041308

1305-
export const Status = (status: StatusProps) => {...
1309+
export const Status = (status: StatusProps) => {
1310+
switch (props.status) {
1311+
case 'success':
1312+
return <div>Title {props.title}</div>;
1313+
case 'loading':
1314+
return <div>Loading {props.time}</div>;
1315+
case 'error':
1316+
return <div>Error {props.error}</div>;
1317+
}
1318+
};
13061319
```
13071320
13081321
### Props To State

0 commit comments

Comments
 (0)