Skip to content

Conversation

@foolishflyfox
Copy link

The ValidatorFunc defined in Factory.ts has a mistake.

For Example:

addGetterSetter<T extends Constructor, U extends Attr<T>>(
    constructor: T,
    attr: U,
    def?: Value<T, U>,
    validator?: ValidatorFunc<Value<T, U>>,
    after?: AfterFunc<T>
)

because Value<T, U> has do ExtractGetSet

type Value<T extends Constructor, U extends Attr<T>> = ExtractGetSet<InstanceType<T>[U]>

but ValidatorFunc do ExtractGetSet again:

type ValidatorFunc<T> = (val: ExtractGetSet<T>, attr: string) => T;

so, the val is always never, and with VSCode can see this phenomenon:

image

my change can fix this mistake:

image

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.

1 participant