Closed geon closed 3 years ago
@Aboisier
I don't know how I could add tests for this. The change affects only the typing. It has no runtime impact.
A test of this would have to involve running the compiler on invalid code and see if it gives the correct error. Probably outside the scope of this project.
@geon
Indeed, the test I had in mind was a happy-path scenario (calling the methods with a readonly array) and would simply prevent accidental changes to the interface.
This has now been published in the latest version,1.5.0. Thanks for your contribution, it is really appreciated, @geon !
The array arguments have no business being mutable.
Purpose
The assertion functions can't be called with ReadonlyArray. That is bad.
Approach
Make the arguments
readonly
.Learnings
https://www.typescriptlang.org/docs/handbook/interfaces.html#readonly-properties