Components.js icon indicating copy to clipboard operation
Components.js copied to clipboard

Run TypeScript code rather than JavaScript code when available

Open RubenVerborgh opened this issue 4 years ago • 2 comments

In case Components.js is run in a situation where the TypeScript sources are available, perhaps it would be interesting to run those instead of the JavaScript. This can save the need to build a project (and also there being 2 versions of code in memory in case other ways of instantiation are used too).

RubenVerborgh avatar Dec 30 '20 22:12 RubenVerborgh

I assume this would be useful for example when running ts-jest?

Should be very feasible to implement using a new creation strategy: https://github.com/LinkedSoftwareDependencies/Components.js/tree/refactor/rdfjs/lib/construction/strategy

rubensworks avatar Dec 31 '20 07:12 rubensworks

I assume this would be useful for example when running ts-jest?

Indeed!

And here is also an interesting case where I had a failing instanceof check, because the tests were running the TypeScript source but Components.js was instantiating the JavaScript version: https://github.com/solid/community-server/commit/1cf1167261be57ec8454c82ccf66153c42f1b983#diff-041823fa178d423e7bd04741d39a3817b6219f2b082109a2d723e5f6a917ec70R59

RubenVerborgh avatar Jan 01 '21 12:01 RubenVerborgh