Skip to content

Simplify ensure() by using the keyof operator #485

Open
@TimVevida

Description

@TimVevida

I'm submitting a feature request

  • Library Version:
    1.1.2

Please tell us about your environment:

  • Operating System:
    Linux (kubuntu)

  • Node Version:
    6.14.1

  • NPM Version:
    3.10.10
  • JSPM Version
    JSPM 0.16.53
  • Language:
    TypeScript 2.8.1

Current behavior:
ValidationRules.ensure(...) accepts both a string or a function. The string should be a property name, and the function should return the property. We are using a function to make use of the Typescript type checking. However, in our code coverage, these functions are mentioned as not being covered by the component tests. This is because the function is never actually executed, but parsed in the PropertyAccessorParser.

Desired behavior:
An easy solution would be to make the ensure(...) argument a keyof TObject. This would both cover the need for type checking and remove the need for a function parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions