-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix and execute Upgrade_20240327_NamespaceInClients
- Loading branch information
1 parent
03a9375
commit 2cf26f9
Showing
260 changed files
with
9,023 additions
and
8,814 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2cf26f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigator, Finder, Operations, and *Client modules get a
namespace
Signum uses static classes in C# a lot, and in the client side the same pattern was implemented using naked .ts/*.tsx files that just exported a bunch of functions and types.
This approach has two problems:
Operations
orAuthClient
doesn't automatically include@framework/Operations
or@extensions/Signum.Authorization/AuthClient
on the top of the file.The solution is to add a big namespace to each of this files, like
export namespace Navigator {...}
orexport namespace AuthClient {...}
and put all the code inside....All?? Really? .... ok not really. There are four cases:
API
orOptions
namespaces, also inside the namespace.EntitySettings
,EntityOperationSettings
ChartRow
etc.. go outside the namespace to avoid having to writenew Navigator.EntitySettings
,new Operations.EntityOperationSettings
andnew ChartClient.ChartRow
.How to upgrade
Upgrade_20240304_Navigator
,Upgrade_20240306_Finder
,Upgrade_20240307_Constructor
,Upgrade_20240307_Operations
,Upgrade_20240312_TypeScript_and_nugets
,Upgrade_20240326_TypeScript_and_nugets2
Upgrade_20240327_NamespaceInClients
. This upgrade this two things:SomeClient.ts(x)
file in aexport namespace SomeClient
Note how
SomeClass
will break because the imports have not been updated but the class is now inside the namespace! This error messages are you TO-DO list to decide what to do with this class:SomeClass
is considered internal then update the components code to useSomeClient.SomeClass
instead, this is the common cases when outside framework.SomeClass
is a popular API (case 4), extractSomeClass
outside of thenamespace SomeClient
to be able to import it easily.Conclusion
I hope this change will pay of with a better IDE performance and auto-completion experience when writing TypeScript code.