Skip to content

ts-check is not convenient when using angular 1.5 component binding injection #26192

Closed

Description

  • VSCode Version: 1.12.1
  • OS Version: Ubuntu 16.04.1 LTS (Xenial Xerus)

Example code:
MyController.js

// @ts-check
class MyController {
    getWorld() {
        return this.world; // <--- Marked as error
    }
}
angular
    .module('myApp')
    .component('myComponent', {
        bindings: {
            'world': '<'
        },
        controller: MyController,
        template: `<div>Hello {{$ctrl.getWorld()}}</div>`
    });

The this.world is marked as error, as supposed to be. But it is actually pretty annoying, because in angular you need to use quite often those component bindings. I know there's the option // @ts-ignore, but that really pollutes the code and makes it less readable.

An extensions for this would be really useful.

I use this workaround at the moment

// @ts-check
class MyController {
    constructor() {
        this.world = this.world;
    }
    getWorld() {
        return this.world;
    }
}

[...]

I don't like this at all, but better than writing // @ts-ignore.

Is there any other option / workaround?

Activity

  1. changed the title [-]ts-check is not enjoyable when using angular 1.5 component binding injection[/-] [+]ts-check is not convenient when using angular 1.5 component binding injection[/+] on May 8, 2017
  2. mjbvz commented on May 10, 2017

    @mjbvz
    Contributor

    This issue was moved to microsoft/TypeScript#15715

  3. added
    upstreamIssue identified as 'upstream' component related (exists outside of VS Code)
    javascriptJavaScript support issues
    on May 10, 2017
  4. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

javascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions