scottdurow / SparkleXrm

An open-source library for building Dynamics CRM XRM solutions using Script#, jQuery & Knockoutjs.
MIT License
264 stars 194 forks source link

Typescript type definition generation using Rosetta #452

Open janis-veinbergs opened 2 years ago

janis-veinbergs commented 2 years ago

Rosetta features automatic typescript definition generation (.d.ts file) from ScriptSharp code. You can view the default output here: https://gist.github.com/janis-veinbergs/4aec76d100de72eeb6784700314da530

I actually had to remove empty [ScriptNamespace("")] attributes from Lookup, Option and Utility classes, otherwise Rosetta throws The ScriptNamespace attribute contains an overriden namespace value which cannot be accepted!. I don't know the implications of it.

Here is the commit that generates .d.ts on build: https://github.com/janis-veinbergs/SparkleXrm/commit/9015ac1c85f13d152cbc9d40d6925d6980e4606d

I'd like some feedback from @scottdurow - what is the implicatjion of removing [ScriptNamespace("")] for said files? I'd like some additional feedback from whoever has done this before - are those .d.ts files usable OOTB?

I'v yet to see if this plays nicely with XrmDefinitelyTyped and if SparkleXrm definitions should be somehow changed to play nicely with those definitions.

I opened this issue to inform the comunity on a promising approach. + I know michaelaird has tried this out (from here) and ideally would like some feedback from him.

P.S. It was most feature-complete/successful methodology of generating typescript definitions. I tried other tools too, but they weren't providing useful results for ScriptSharp code:

I actually don't expect someone would notice or care or provide feedback, as the world has moved on, but anyways... even if it helps someone with information, profit! #47

janis-veinbergs commented 2 years ago

Ha, ScriptName attribute is not honored by Rosetta. I'll try to fix that and and let's see if owner will include those changes in Rosetta: https://github.com/andry-tino/Rosetta/pull/59

There are other issues when I tried generating mscorlib definitions. So definitions are still work-in-progress.