Skip to content
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

Made array arguments readonly. #78

Merged
merged 3 commits into from
Jul 11, 2021
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/lib/assertion/expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Expect {
* @param expected Expected array.
* @param message Custom assertion failure message.
*/
public arraysToBeEqual<T extends unknown[]>(actual: T, expected: T, message?: string) {
public arraysToBeEqual<T extends readonly unknown[]>(actual: T, expected: T, message?: string) {
if (actual.length !== expected.length)
throw new ExpectationError(message || `Expected sequences to be equal, but their lenghts were different.`);

Expand Down Expand Up @@ -219,7 +219,7 @@ class Expect {
* @param array Array in which the given item is expected to be.
* @param message Custom assertion failure message.
*/
public toBeIn<T>(item: T, array: T[], message?: string) {
public toBeIn<T>(item: T, array: readonly T[], message?: string) {
const isIn = array.find((x) => x === item);
if (this.notFlag ? isIn : !isIn) {
throw new ExpectationError(
Expand Down