delegateas / XrmDefinitelyTyped

Tool to generate TypeScript declaration files for Dynamics 365/CDS client-side coding.
http://delegateas.github.io/Delegate.XrmDefinitelyTyped/
MIT License
133 stars 53 forks source link

181 override xrm namespace #278

Open misoeli opened 2 years ago

misoeli commented 2 years ago

Allow for overriding the Xrm namespace, providing a custom one if needed.

Instead of wrapping Xrm in another namespace level (which would require an additional namespace declaration in both xrm.d.ts AND all version-specific files, simply renaming the namespace keeps the needed changes down.

Still not sure it works. It looked as if VS was acting up post generation, but I would prefer a re-review.

misoeli commented 2 years ago

Fixes #181 .

misoeli commented 2 years ago

@skovlund Looks OK to me after retesting. Most likely just a case of old dependencies. Would like you to have a look though.

majblackburn commented 2 years ago

pulling and attempting to compile (although I'm not an F# dev). Thanks SO MUCH for this -- we were a bit stuck on our attempt to bring TDD into a project with XrmDT!

majblackburn commented 2 years ago

This has resolved our issues with the conflict between @types/xrm and XrmDT. I'd like to suggest "XrmDT" instead of "xrmns" as a default, but I'm in no way complaining! Thanks again!

skovlund commented 2 years ago

@misoeli I've looked through the changes and it looks fine. However, I've not tested and therefore have not verified that we have caught every instance of "Xrm".

@majblackburn I'm not entirely sure I understand your suggestion. The namespace still defaults to "Xrm" (for backward compatibility) and not to either "XrmDT" nor "xrmns" (by the way, we usually abbreviate the tool "XDT"). However, "XRMNS" is used internally in code as placeholder text before replacing it with the custom namespace name. If you are referring to the argument "xrmNamespace" given the alternative command "xrmNs" I think this might be better abbreviated to simply "ns".