Skip to content

Commit 7ddca39

Browse files
committed
docs(recipes): Fix typos in AsyncLocalStorage
1 parent 4a165ed commit 7ddca39

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

content/recipes/async-local-storage.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ NestJS itself does not provide any built-in abstraction for `AsyncLocalStorage`,
2020
import { AsyncLocalStorage } from 'async_hooks';
2121
import { Module } from '@nestjs/core';
2222

23-
export const asyncLocalStorage = new AsyncLocalStorage();
24-
2523
@Module({
2624
providers: [
2725
{
2826
provide: AsyncLocalStorage,
29-
useValue: asyncLocalStorage,
27+
useValue: new AsyncLocalStorage(),
3028
},
3129
],
3230
exports: [AsyncLocalStorage],
@@ -41,7 +39,7 @@ export class AlsModule {}
4139

4240
import { NestFactory } from '@nestjs/core';
4341
import { AppModule } from './app.module';
44-
import { asyncLocalStorage } from './als.setup.ts';
42+
import { AsyncLocalStorage } from './als.module.ts';
4543

4644
async function bootstrap() {
4745
const app = await NestFactory.create(AppModule);
@@ -57,7 +55,7 @@ async function bootstrap() {
5755
const store = {
5856
userId: req.headers['x-user-id'],
5957
};
60-
// and and pass the "next" function as callback
58+
// and pass the "next" function as callback
6159
// to the "als.run" method together with the store.
6260
als.run(store, () => next());
6361
});
@@ -209,7 +207,7 @@ describe('CatService', () => {
209207
(id) => ({ userId: id })
210208
)
211209

212-
// Wrap the test call the `runWith` method
210+
// Wrap the test call in the `runWith` method
213211
// in which we can pass hand-crafted store values.
214212
const cat = await cls.runWith(
215213
{ userId: expectedUserId },

0 commit comments

Comments
 (0)