Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4477

Spike: Explore using readonly more and enable linting to require its use

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Tooling

      Description

      TS APIs can define their input types as readonly preventing the code that uses the inputs from mutating them. Our APIs do not make much use of readonly which prevents readonly inputs from being passed to the driver. Where as if we used readonly, mutable inputs would still be permitted along with immutable ones. This can lead to some friction around tuple arguments particularly which usually have to be cast to be constant if not frozen to get TS to correctly discover their type.

      Lint rule that could serve us: https://typescript-eslint.io/rules/prefer-readonly-parameter-types

      AC

      • Requires some investigation to see the full benefits and level of effort this would take.

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: