-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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.
- is related to
-
NODE-6252 collection.insertMany give type error when passed a readonly array
- Closed