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: add PropsWithType to get all property names that are of a given type #3

Merged
merged 1 commit into from Sep 11, 2019

Conversation

onebytegone
Copy link
Contributor

No description provided.

@onebytegone onebytegone changed the title feat: add type to get all the property names have a given type feat: add PropsWithType to get all property names that are of a given type Sep 11, 2019

let obj: TestType = { prop: 'test', anotherProp: 1, additionalProp: 2 };

expect(getNumber(obj, 'anotherProp')).to.strictlyEqual(1);
Copy link
Member

Choose a reason for hiding this comment

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

ADIRL: it'd be nice to actually validate that getNumber(obj, 'prop') and getNumber(obj, 'doesNotExist') both fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think something like dtslint has promise for this type of testing. I've pushed a WIP example here. However, as that will be more work to implement, I vote we do that work in a later PR.

@jthomerson
Copy link
Member

@onebytegone also, your commit message failed commitlint

@jthomerson jthomerson merged commit 808d99d into master Sep 11, 2019
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.

None yet

2 participants