ealush / vest

Vest ✅ Declarative validations framework
https://vestjs.dev/
MIT License
2.57k stars 85 forks source link

Cannot find name 'Predicate'. Did you mean 'Predicates'? #1107

Closed faribauc closed 1 year ago

faribauc commented 1 year ago

Angular: 17.0.4 NodeJSL: 18.13.0 vest: 5.1.5

Hi!

This package looks very promissing for my project and I'm eager to play with it! But...

I literally copy/pasted the example code from the code:

import { create, test, enforce } from 'vest';

const suite = create((data = {}) => {
  test('username', 'Username is required', () => {
    enforce(data.username).isNotBlank();
  });

  test('username', 'Username must be at least 3 characters long', () => {
    enforce(data.username).longerThan(2);
  });
});

into a component and I'm getting the following error:

node_modules/vest-utils/types/vest-utils.d.ts:175:15 - error TS2552: Cannot find name 'Predicate'. Did you mean 'Predicates'?

175 export type { Predicate, DropFirst, Stringable, CB, ValueOf, Nullish, Nullable, Maybe, OneOrMoreOf, DynamicValue, BlankValue };
                  ~~~~~~~~~

  node_modules/vest-utils/types/vest-utils.d.ts:169:19
    169 declare namespace Predicates {
                          ~~~~~~~~~~
    'Predicates' is declared here.

I was expecting this to be easy to setup. Am I missing something?

Thanks!

ealush commented 1 year ago

I can confirm I am seeing this too. Let me check and get back to you shortly.

faribauc commented 1 year ago

@ealush Awesome, thank you. Can't wait to give this lib a try! ::)

ealush commented 1 year ago

@faribauc Thank you! I just released 5.2.0, can you confirm this now works for you?

So sorry that you're experiencing this!

faribauc commented 1 year ago

@ealush Fix confirmed! Thanks a lot for the super fast response!

ealush commented 1 year ago

Great! Thank you for reporting this issue 🙏