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

Typings incomplete / using any instead of type #557

Open
MJLHThomassen-Sorama opened this issue Apr 19, 2021 · 2 comments
Open

Typings incomplete / using any instead of type #557

MJLHThomassen-Sorama opened this issue Apr 19, 2021 · 2 comments

Comments

@MJLHThomassen-Sorama
Copy link

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<TObject, TValue>(property: string | number | PropertyAccessor<TObject, TValue>): FluentRules<TObject, any>;

The ensure() method returns a FluentRules<TObject, any>, wile i would expect it to return a FluentRules<TObject, TValue>.
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.

@Sayan751
Copy link
Member

I think the typing issue is fixed from the beginning in Aurelia v2. However, I am sure if we have the bandwidth to fix v1 issues :(

@Alexander-Taran
Copy link

Would you like to provide a pull request for it @MJLHThomassen-Sorama ?

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

No branches or pull requests

3 participants