From b75d242000f4dd3bd25d5c31bdd5b15967173a52 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 23 Aug 2021 14:12:36 -0400 Subject: [PATCH] docs: explain the need for new variable is for TS --- src/cursor/abstract_cursor.ts | 9 +++++---- src/cursor/aggregation_cursor.ts | 5 +++-- src/cursor/find_cursor.ts | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cursor/abstract_cursor.ts b/src/cursor/abstract_cursor.ts index f5ff2be5ca3..8f2e009c181 100644 --- a/src/cursor/abstract_cursor.ts +++ b/src/cursor/abstract_cursor.ts @@ -457,11 +457,12 @@ export abstract class AbstractCursor< * Map all documents using the provided function * If there is a transform set on the cursor, that will be called first and the result passed to * this function's transform. - * @remarks * - * **NOTE:** adding a transform changes the return type of the iteration of this cursor, it **does not** return - * a new instance of a cursor. This means when calling map, you should always assign the result to a new - * variable. Take note of the following example: + * @remarks + * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor, + * it **does not** return a new instance of a cursor. This means when calling map, + * you should always assign the result to a new variable in order to get a correctly typed cursor variable. + * Take note of the following example: * * @example * ```typescript diff --git a/src/cursor/aggregation_cursor.ts b/src/cursor/aggregation_cursor.ts index 4afff532b9c..a52f58a21e1 100644 --- a/src/cursor/aggregation_cursor.ts +++ b/src/cursor/aggregation_cursor.ts @@ -149,9 +149,10 @@ export class AggregationCursor extends AbstractCursor extends AbstractCursor { * * @remarks * - * Adding a projection changes the return type of the iteration of this cursor, + * **Note for Typescript Users:** adding a transform changes the return type of the iteration of this cursor, * it **does not** return a new instance of a cursor. This means when calling project, - * you should always assign the result to a new variable. Take note of the following example: + * you should always assign the result to a new variable in order to get a correctly typed cursor variable. + * Take note of the following example: * * @example * ```typescript