svenheden / csharp-models-to-typescript

C# models to TypeScript
88 stars 58 forks source link

Keep C# enum value sequence #79

Closed digocesar closed 3 months ago

digocesar commented 3 months ago

As I could test, TypeScript folow the same C# numbering sequence when enum value is missing in declaring type. I think that if no number is defined in C#, it could remains not defined in TypeScript. @svenheden and @SafeerH, any idea of problems we might have with this change?

C#: https://sharplab.io/#v2:CYLg1APgAgzABAUwHYFcC2cBCBLANr7JAcwGEBPAY1wQFgAoAb3rhYEEAaZlzOAXjgDsnOizglhogCJ84AFgksAovQC+QA== TypeScript: https://www.typescriptlang.org/play/?#code/KYOwrgtgBAQglgGwXEBzAwgTwMYOAKAG98pSBBAGhNJigF4oB2K0qdF0gEXqgBYOoAUXwBfIA

Closes #29

svenheden commented 3 months ago

As I could test, TypeScript folow the same C# numbering sequence when enum value is missing in declaring type. I think that if no number is defined in C#, it could remains not defined in TypeScript. @svenheden and @SafeerH, any idea of problems we might have with this change?

No to my ears that sounds solid, go for it 👍

SafeerH commented 3 months ago

As I could test, TypeScript folow the same C# numbering sequence when enum value is missing in declaring type. I think that if no number is defined in C#, it could remains not defined in TypeScript. @svenheden and @SafeerH, any idea of problems we might have with this change?

C#: https://sharplab.io/#v2:CYLg1APgAgzABAUwHYFcC2cBCBLANr7JAcwGEBPAY1wQFgAoAb3rhYEEAaZlzOAXjgDsnOizglhogCJ84AFgksAovQC+QA== TypeScript: https://www.typescriptlang.org/play/?#code/KYOwrgtgBAQglgGwXEBzAwgTwMYOAKAG98pSBBAGhNJigF4oB2K0qdF0gEXqgBYOoAUXwBfIA

Closes #29

Sounds good to me! 👍

SafeerH commented 3 months ago

@digocesar could you add G value to the TestEnum in TestClass.cs just for the completeness?

public enum TestEnum {
    ...
    G    // 27 in decimal
}

Also, some suggestions to consider:

digocesar commented 3 months ago

@digocesar could you add G value to the TestEnum in TestClass.cs just for the completeness?

public enum TestEnum {
    ...
    G    // 27 in decimal
}

Also, some suggestions to consider:

  • Change the TestClass.cs file name to TestFile.cs (because we now have enum as well)
  • Change the namespace to TestNamespace (instead of TestClass)

Done.

SafeerH commented 3 months ago

Hey guys @svenheden @digocesar, I think it is a high time we publish a new NPM release. Also, what do you guys think about bumping up the major version - because we migrated to .NET 8 and we have a lot of other good improvements as well?

digocesar commented 3 months ago

Hey guys @svenheden @digocesar, I think it is a high time we publish a new NPM release. Also, what do you guys think about bumping up the major version - because we migrated to .NET 8 and we have a lot of other good improvements as well?

I was thinking to suggest it too. I think we should release a version so that the component works again and then we will make other improvements.

svenheden commented 3 months ago

Sounds good guys! I just bumped the version to 1.0.0 and published to npm.

@SafeerH @digocesar