Thursday, 21 November 2019

Autocompletion for private NPM package

I am trying to create my own private NPM package. I want to use this package in several other projects of mine. You can imagine it like UI library. I use babel for code transpilation.

Let's assume very simple example:

src/index.js

class UI {
  static testMethod() {
    return null
  }
}

export default UI

This file gets transpiled using babel: babel ./src --out-dir ./dist --source-maps

When I publish this package and install it in another project everything works just fine but IDE shows me warning that UI class doesn't have method testMethod. I am using WebStrom. I also tried VS Code and it doesn't work either.

My questions are: What am I missing?

Do I need to write JSdoc comments or use Typescript?

Aren't source maps enough?



from Autocompletion for private NPM package

No comments:

Post a Comment