power-assert-js/espower-typescript

[Suggestion] Make TypeScript Compiler choosable

HerringtonDarkholme opened this issue · 4 comments

Hi, I really love the power of assert in TypeScript, thank you for brining up this plugin!

However, I found espower-typescript relies on specific compiler. typescript-simple does give user a easy api to work with. But since typescript itself is constantly changing, I think it may be better espower user can choose a specific version of tsc. I think providing a config file is a better choice because espower-typescript is supposed to be a require register.

On the other hand, typescript-simple can still be a peer-dependency so that it can be an opt-in compiler.
Related issue. teppeis/typescript-simple#17

@HerringtonDarkholme Yes, I think it's better too. But TypeScript has breaking changes between different versions, so it's difficult to support multiple versions.
Do you have any idea to implement it?

FYI: You can choose TS version by specifying espower-typescript version.

  • espower-typescript v5.x uses TypeScript v1.8
  • espower-typescript v4.x uses TypeScript v1.7
  • espower-typescript v2.x and v3.x uses TypeScript v1.6
  • espower-typescript v1.x uses TypeScript v1.5

and only latest version is actively maintained.

Thanks for your maintenance!

I would suggest that TypeScript does not bring many breaking changes since 1.5. Given the api-breaking page, TS1.5+ has fairly stable api. Polyfilling compiler seems to be easy, for example.

For large breaking change, I think a version bumping is not avoidable.

The point here is, if a breaking change happens in tsc, an espower-typescript user must update espower. But if a change happens in tsc yet not breaking, espower-typescript user can still use a newer compiler.

So users benefit from choosable compiler, yet it does not place more burden on maintainer.

@HerringtonDarkholme
espower-typescript uses typescript-simple to compile TS files internally.

APIs of typescript-simple absorbs breaking changes of typescript.
So if I loose version specifier of typescript-simple in package.json of espower-typescript, users may be able to choose typescript version by specifying version of typescript-simple.