Skip to content

Selective Backport DOCSP-25723 #461

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

Merged
merged 2 commits into from
Dec 6, 2022
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
14 changes: 4 additions & 10 deletions source/includes/limitations/limits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ Learn about the following TypeScript specific limitations of the {+driver-short+
Recursive Types and Dot Notation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. important:: Impacted Versions

- 4.3
- 4.4

The {+driver-short+} cannot provide type safety within nested instances of
**recursive types** referenced through dot notation.

Expand Down Expand Up @@ -80,10 +75,11 @@ in the MongoDB manual.
Mutual Recursion
~~~~~~~~~~~~~~~~

.. important:: Impacted Versions
.. important::

- 4.3
- 4.4
In this driver version, you cannot specify a mutually recursive type as a
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.

Expand Down Expand Up @@ -115,5 +111,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+}.