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

Update: Concat #47

Merged
merged 8 commits into from
Jun 29, 2023
Merged

Update: Concat #47

merged 8 commits into from
Jun 29, 2023

Conversation

Harris-Miller
Copy link
Collaborator

@Harris-Miller Harris-Miller commented Jun 26, 2023

This update aligns the type def for concat to match the native Array#concat() method. Specifically to disallow concatenation of arrays of different types. That existing type def for concat was not typesafe and it should have never been that

It also improves the types for concat on strings a bit

Copy link
Contributor

@lax4mike lax4mike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍🏻

expectType<string>(concat(__, 'DEF' as string)('ABC' as string));
expectType<string>(concat('ABC' as string, 'DEF' as string));

expectType<number[]>([1, 2, 3].concat([4, 5, 6]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how you put the native .concat in here too for reference!

@Harris-Miller Harris-Miller merged commit a59aea5 into develop Jun 29, 2023
@Harris-Miller Harris-Miller deleted the concat branch June 29, 2023 02:43
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

Successfully merging this pull request may close these issues.

2 participants