Home > Enterprise >  Code completion for constructor parameter types
Code completion for constructor parameter types

Time:05-19

I often have to inject dependencies in some class:

class Foo {
  constructor(private userService: UserService) {
  }
}

What I'm looking for is a code completion for a UserService type when I'm typing userService:

class Foo {
  constructor(private userSer) { // <-- suggests UserService type so I can get the previous code example
  }
}

I know it is possible with Kotlin and IntelliJ IDEA but I'm wondering whether it is possible with TypeScript and WebStorm.

CodePudding user response:

In Settings | Editor | General | Code Completion, JavaScript, try enabling both Suggest variable and parameter names and Add type annotations for suggested parameter names - does it help?

  • Related