DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Is it possible for a JS library to have full TS support, but doesn't use TS extension?

For example, I want to use Flow, as well as Babel, probably also with tcomb. (or some other reasons?)

To compile with tsc to JavaScript for web browsers, you have to add .js to all imports and exports. This is a known issue in TypeScript (and probably wontfix).

IMO, Babel can be more powerful than TypeScript, as it allows me to define my own grammars; therefore, more plugins to choose, not limited to a single authority. Also, plugins are written in JavaScript, therefore can emit JavaScript codes, not only some IDE safety only.

I know both Flow and TypeScript emit their own specific type definitions, not cross-compatible with each other; but are there ways to normalize that (e.g. emit JSDoc as well)?

I have seen repos with *.d.ts inside it. Are there libraries to help writing that?

Top comments (0)