For the sake of this guide, I will choose the name my-awesome-greeter, but use a unique name so you can publish your package to npm later on □. Since there are 700k+ packages, make a quick search on to make sure your awesome name is not already taken. Package names have to be in pascal-case and in lowercase. node -v v17.8.0 npm -v 8.5.5 Pick a great name Make sure you have the latest version of node and npm. Even if the one using your package doesn’t use Typescript, some editors, like Visual Studio Code will still use the type-definitions to give the user better IntelliSense.Strong typings are more self-documenting and make the code more understandable.With type-definitions in the package, the user doesn’t have to download the types from another package.The package can be used both for Typescript and Javascript users! If your library becomes popular there will sooner or later be a demand for type-definitions, and to write those manually is time-consuming, error-prone, and harder to update. More robust code and easier to maintain.I can agree when it comes to small-scale projects, however, when it comes to package development, Typescript has some serious advantages: Some of you might feel that strong typing decreases productivity and it’s not worth the effort to use.
0 Comments
Leave a Reply. |