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

feat (enumProperty): new decorator #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat (enumProperty): new decorator #17

wants to merge 1 commit into from

Conversation

43081j
Copy link
Owner

@43081j 43081j commented May 30, 2023

The enumProperty decorator can be used as a drop-in replacement for the built-in property decorator but with an enum constraint enforced.

For example:

@enumProperty({
  values: ['a', 'b']
})
public value?: string;

In this example, value can only be set to a or b and will be reset to undefined otherwise.

The `enumProperty` decorator can be used as a drop-in replacement for
the built-in `property` decorator but with an enum constraint enforced.

For example:

```ts
@enumProperty({
  values: ['a', 'b']
})
public value?: string;
```

In this example, `value` can only be set to `a` or `b` and will be reset
to `undefined` otherwise.
@coveralls
Copy link

coveralls commented May 30, 2023

Pull Request Test Coverage Report for Build 5126508559

  • 63 of 63 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 98.246%

Totals Coverage Status
Change from base Build 4693442025: 0.009%
Covered Lines: 2163
Relevant Lines: 2184

💛 - Coveralls

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