Skip to content

feat (enumProperty): new decorator#17

Open
43081j wants to merge 1 commit into
mainfrom
enum-property
Open

feat (enumProperty): new decorator#17
43081j wants to merge 1 commit into
mainfrom
enum-property

Conversation

@43081j

@43081j 43081j commented May 30, 2023

Copy link
Copy Markdown
Owner

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

coveralls commented May 30, 2023

Copy link
Copy Markdown

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