Skip to content

Add generic type parameter to startsWith/endsWith #46959

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

Closed
wants to merge 2 commits into from

Conversation

LinusU
Copy link
Contributor

@LinusU LinusU commented Nov 30, 2021

Fixes #46958

Sorry for being a bit quick to open this PR, I started by editing the code and then later found out about the proper process. I figured it would be good to open this one anyways a suggestion on how to fix the issue I opened.

I also had a hard time figuring out where to add tests for this. It's not under "Contributing lib.d.ts fixes" and "Adding a Test" seems to be for compiler tests cases. Any help appreciated!

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 30, 2021
@xiBread
Copy link

xiBread commented Nov 30, 2021

This wouldn't handle cases where a position is passed.

@LinusU
Copy link
Contributor Author

LinusU commented Nov 30, 2021

@xiBread you are very right, don't know how I missed that 😅

Will push a commit addressing this asap

@LinusU
Copy link
Contributor Author

LinusU commented Nov 30, 2021

Amended the commit to account for the position parameter.

Here are some preliminary tests in a playground: link

Would still like to add these as proper tests as soon as I know where to put them!

@LinusU
Copy link
Contributor Author

LinusU commented Nov 30, 2021

I've added tests, but they might be in the wrong place 😅

@LinusU
Copy link
Contributor Author

LinusU commented Dec 1, 2021

Closing per discussion in #46958

@LinusU LinusU closed this Dec 1, 2021
@typescript-bot
Copy link
Collaborator

The TypeScript team hasn't accepted the linked issue #46958. If you can get it accepted, this PR will have a better chance of being reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using startsWith & endsWith to narrow type
3 participants