Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions source/fundamentals/typescript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ For more information on object types, see the
Type Parameters that Extend Document
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following classes accept all types that both extend
the ``Document`` interface and are not mutually recursive:
The following classes accept all types that extend the ``Document`` interface:

.. _node-mongodb-type-parameters-extend-document:

Expand All @@ -71,14 +70,10 @@ You can pass a type parameter that extends the ``Document`` interface like this:
:start-after: start-no-key
:end-before: end-no-key

To view an example of a mutually recursive type, which is not supported by the
:ref:`preceding classes <node-mongodb-type-parameters-extend-document>`,
see the :ref:`<node-driver-limitations-mutual-recursion>` section.

Type Parameters of Any Type
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following classes accept all type parameters that are not mutually recursive:
The following classes accept all type parameters:

.. _node-mongodb-type-parameters-any-type:

Expand All @@ -89,11 +84,6 @@ You can find a code snippet that shows how to specify a type for the ``FindCurso
class in the
:ref:`Find Multiple Documents Usage Example <node-driver-find-usage-example-code-snippet>`.

To view an example of a mutually recursive type, which is not supported by the
:ref:`preceding classes <node-mongodb-type-parameters-any-type>`,
see the :ref:`<node-driver-limitations-mutual-recursion>` section.


Type Safety and Dot Notation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
11 changes: 7 additions & 4 deletions source/includes/limitations/4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ in the MongoDB manual.
Mutual Recursion
~~~~~~~~~~~~~~~~

You cannot specify a **mutually recursive** type as a type parameter in version
4.3 of the driver.
.. important::

In this driver version, you cannot specify a mutually recursive type as a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
This seems like repeated content with the first sentence. I think it could be more straightforward to lead this section with the sentence "You cannot specify a ..." and then have an informational admonition that follows mentioning that you can use mutually recursive types in type parameters in v4.11 and later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that would make things read a bit smoother. Since the other versions (v4-10) have this admonition I'm leaning towards merging as-is for consistency's sake, but I can create a quick cleanup ticket to reword at a later time

type parameter. To specify a mutually recursive type as a type parameter,
use version 4.11 or newer.

You cannot specify a **mutually recursive** type as a type parameter.

A mutually recursive type exists when two types contain a property that is of
the other's type. You can update the
Expand Down Expand Up @@ -107,5 +112,3 @@ following error:

error TS2615: Type of property 'r' circularly references itself in mapped type '{ [Key in keyof MutuallyRecursive]...

If you must apply a mutually recursive type to your classes, use version 4.2 of
the {+driver-short+}.