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

Fails to compile #65

Closed
grosch opened this issue Dec 16, 2020 · 4 comments
Closed

Fails to compile #65

grosch opened this issue Dec 16, 2020 · 4 comments

Comments

@grosch
Copy link

grosch commented Dec 16, 2020

I'm submitting a...


[X] Bug report  

Current behavior

When I build my project I'm getting compiler errors from the controls in this package. For example, this is the first one that appears:

Error: node_modules/@ngneat/reactive-forms/lib/formControl.d.ts:20:9 - error TS2416: Property 'asyncValidator' in type 'FormControl<T, E>' is not assignable to the same property in base type 'FormControl'.
Type 'AsyncValidatorFn<T, any> | null' is not assignable to type 'AsyncValidatorFn | null'.
Type 'AsyncValidatorFn<T, any>' is not assignable to type 'AsyncValidatorFn'.
Types of parameters 'control' and 'control' are incompatible.
Type 'AbstractControl' is missing the following properties from type 'AbstractControl<T, any>': touch$, dirty$, disabled$, enabled$, status$

20 get asyncValidator(): AsyncValidatorFn | null;

Minimal reproduction of the problem with instructions

example.zip

Environment


Angular version: 11.0.0
For Tooling issues:
- Node version: v15.3.0
- Platform:  mac BigSur 11.1

Others:

I saw the pinned issue, but while similar I think this is different as I'm just simply doing a build with your package included.

@itayod
Copy link
Contributor

itayod commented Dec 17, 2020

@grosch which version do you use? could you post here the code snippet that fails?

@grosch
Copy link
Author

grosch commented Dec 17, 2020

I'm using 1.5. I attached an example project, but here's the app.component.ts

import {FormBuilder} from '@ngneat/reactive-forms'

interface Data {
    title: string
    chapters: string[]
}

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
export class AppComponent {
    readonly formGroup = this.fb.group<Data>({
        title: ['', Validators.required],
        chapters: this.fb.array<string>([], Validators.min(3))
    })

    constructor(private readonly fb: FormBuilder) {
    }
}

@itayod
Copy link
Contributor

itayod commented Dec 20, 2020

@grosch please upgrade to the latest version and see if it works.

@grosch
Copy link
Author

grosch commented Dec 20, 2020

Looks like 1.5.1 fixed it.

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

2 participants