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

support for indexOf #91

Closed
wyattades opened this issue Mar 1, 2023 · 1 comment
Closed

support for indexOf #91

wyattades opened this issue Mar 1, 2023 · 1 comment

Comments

@wyattades
Copy link

As far as I can tell, this is the exact same reasoning as .includes (and may belong in the same entrypoint)? Happy to open a PR depending on your feedback.

Example:

// BEFORE
const users = ["matt", "sofia", "waqas"] as const;

// Argument of type '"bryan"' is not assignable to
// parameter of type '"matt" | "sofia" | "waqas"'.
users.indexOf("bryan");
// AFTER
import "@total-typescript/ts-reset/array-indexof"; // or array-includes?

const users = ["matt", "sofia", "waqas"] as const;

// .indexOf now takes a string as the first parameter
users.indexOf("bryan")
@mattpocock
Copy link
Owner

Makes a ton of sense!

mattpocock added a commit that referenced this issue Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants