Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript type definition generation using Rosetta #452

Open
janis-veinbergs opened this issue Feb 21, 2022 · 1 comment
Open

Typescript type definition generation using Rosetta #452

janis-veinbergs opened this issue Feb 21, 2022 · 1 comment

Comments

@janis-veinbergs
Copy link
Contributor

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: janis-veinbergs@9015ac1

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:

  • netjs
  • dts-gen
  • tsc --declaration --emitDeclarationOnly --allowJs (Typescript compiler) by feeding in SparkleXrm.js

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
Copy link
Contributor Author

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: andry-tino/Rosetta#59

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant