Skip to content

[Feature request][Language Service] Warn user when Input/output does not exist in component and type checking #21204

Closed

Description

@Tukks

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

given this component :

@Component({
 selector: 'example-component',
 templateUrl: 'example-component.component.html',
 styleUrls: ['example-component.component.scss']
})
export class ExampleComponent {
 @Input() label: string;
@Output() event: string;
}

If I wrote this in another template like this :

<example-component [label]="1" [noExistingInput]="'label'" (event)="exampleMethod()">
<example-component>

I have no warning on the noExistingInput, and no warning on label input waiting for a string and receiving a number.

Expected behavior

showing error saying no existing input/output and type mismatch in html template

What is the motivation / use case for changing the behavior?

better linter integration, less AOT build error

Activity

  1. trotyl commented on Dec 29, 2017

    @trotyl
    Contributor

    There's no type-checking for events, which is tracked by #17483.

    Language service support would require compiler support comes first.

  2. Tukks commented on Dec 29, 2017

    @Tukks
    Author

    Ok I understand, thank's for your response.
    and for noExistingInput? and Input() typecheck? these are not event.

  3. CDDelta commented on Dec 30, 2017

    @CDDelta

    @Tukks I think you have the syntax wrong. @Input binding is done with [()] for two way or [] for one way binding. @Output binding is done with (). The language service already reports noExistingInput errors. As for type checking, that is not being done. You should have a look at #21143 and @angular/cdk/coercion.

  4. Tukks commented on Dec 30, 2017

    @Tukks
    Author

    @CDDelta I edited my issue. Language service doesn't report the noExistingInput in vscode and in webstorm.
    I can't do a plunker with this.

  5. CDDelta commented on Dec 30, 2017

    @CDDelta

    @Tukks the language service does report noExistingInput for me though and I am using vscode. It, however, does not report noExistingOutput when I tried it.

  6. Tukks commented on Dec 30, 2017

    @Tukks
    Author

    @CDDelta I created a project with Angular Cli, and yes the service does report noExistingInput in Vscode, mabe the other project is to big to be handled by Language service.
    I will drive more test to see what happen.
    I close this issue until I have more info.

  7. angular-automatic-lock-bot commented on Sep 13, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions