I feel your pain on this. As an occasional NPM library author, I feel that Typescript can help with this, although NPM itself is not structured in a way that compliments Typescript: it’s awkward to write in Typescript, publish to javascript, then consumers fetch your library and go back to writing in Typescript.