aurelia / aurelia/validation

Typings incomplete / using any instead of type

Open
#557 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
129
Forks
125
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
2.0.0-rc2

**Please tell us about your environment:**
* **Operating System:**
Windows 10

* **Node Version:**
v14.15.5

* **NPM Version:**
6.14.8

* **Browser:**
all

* **Language:**
TypeScript

**Current behavior:**

In the aurelia-validation.d.ts file currently there this bit of code:
```
export declare class ValidationRules {
private static parsers;
static initialize(messageParser: ValidationMessageParser, propertyParser: PropertyAccessorParser): void;
/**
* Target a property with validation rules.
* @param property The property to target. Can be the property name or a property accessor function.
*/
static ensure(property: string | number | PropertyAccessor): FluentRules;
```
The ensure() method returns a FluentRules, wile i would expect it to return a FluentRules.
The FluentRules class is fully typed properly with the TValue parameter, but all instances of FluentRules specify "any" as the second type parameter which cancels all the nice typescript benefits of type checking on the value.

**Expected/desired behavior:**
All methods that return a FluentRules have it properly typed, 'any' is not used.

Contributor guide

Open the contributing guide

Research direction

Start in aurelia-validation.d.ts with ValidationRules.ensure and inspect every declaration that returns FluentRules. Compare each return type with its TValue parameter and confirm that no FluentRules return uses any; done means the typings preserve value-level type checking throughout.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.