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

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

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?

Posted on by:

patarapolw profile

Pacharapol Withayasakpunt


Currently interested in TypeScript, Vue, Kotlin and Python. Looking forward to learning DevOps, though.


markdown guide

Yes. But it would require it to make it's own implementation of TypeScript, which is super-hard if not impossible.
So it will be uncommon / not appearing.