Conversation
|
Can you extend the tests? |
|
any news about this? |
Contributor
Author
|
Hi @mxaGianluca, I’d love to contribute more to this package, but I noticed it has been a bit quiet lately. Are there plans to actively maintain this project going forward? I'm happy to help out where I can. |
Contributor
|
Hi @rick-bongers thank you for this PR. I've been too busy and haven't checked it out yet. But I do intend on maintaining this package. I'll get back to you once I've checked it out. |
Contributor
|
Hey @rick-bongers i've just looked at your commits and I want to merge them but the tests are failing. The assertions aren't correct. Tests\Types\TypesTest > it can determine a type from a value with (Vagebond\Runtype\Tests\Fakes\Enums\TestEnum…
Failed asserting that two strings are identical.
-'enum-value-1 | enum-value-2'
+''enum-value-1' | 'enum-value-2''
at tests/Types/TypesTest.php:9
5▕ use Vagebond\Runtype\Tests\Fakes\Resources\ProductResource;
6▕ use Vagebond\Runtype\Types\Types;
7▕
8▕ it('can determine a type from a value', function ($value, $expected) {
➜ 9▕ expect((new Types(getConfig()))->determineType($value))->toBe($expected);
10▕ })->with([
11▕ ['string', 'string'],
12▕ [true, 'boolean'],
13▕ [1, 'number'],
1 tests/Types/TypesTest.php:9 |
Contributor
Author
|
@mxaGianluca my mistake! I've fixed the tests |
Contributor
|
Thank you for your contribution @rick-bongers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances enum type handling in the
Typesclass to improve how PHP enums are converted for TypeScript type generation. The most important changes are the addition of support forBackedEnuminstances and a new method for processing enums.Enum type handling improvements:
determineTypemethod insrc/Types/Types.phpto handle values that are instances of\BackedEnum, delegating their processing to the newprocessEnummethod.processEnuminsrc/Types/Types.phpthat generates a TypeScript union type string from all possible enum values, properly quoting string values.