configcat / common-js

Common Javascript library for ConfigCat. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
https://configcat.com
MIT License
16 stars 10 forks source link

Odd? values in DataGovernance enum #42

Closed GabrielCousin closed 2 years ago

GabrielCousin commented 2 years ago

Describe the bug

Hello, I'm currently working on updating the Ember addon we published for ConfigCat. I ran into some TypeScript error: when trying to build a typed options object for the ConfigCat Client, I noticed some difference between the DataGovernance exported here https://github.com/configcat/common-js/blob/df5ef91401aa3cc15139240adfe7d371ce28c2c7/src/ConfigCatClientOptions.ts#L8 and the value expected by the documentation here https://configcat.com/docs/sdk-reference/js#auto-polling-default Which are the correct values?:

To reproduce

TypeScript Sandbox https://www.typescriptlang.org/play?#code/PQKhAIGEHsDsBcBO0A254AsCm4XQMYCG8AlnONAGbrbj5yUkDmAdAFYDO5jKWHdceIRKwRTcAE9oAV0ThKWYrJyUUhJv0KwAJuA5Z4pWBvAB3EphE0cMWIyaRiUACIA5FuBDAAUFgAeAA7QiPDgWLDSALbgzsSEAOLQAG5YiLBa+DgA3t7geeCgEADKWLz4oZb8JNRSsvKK8MryaiaEiDgB0gBGKCQc2Lrw0OCEKGhMeF2jLq7gsNDafB5eufnxk9MAvOAADAA0q3mF4CVlFRh94NWSMnIKSu3N6pqPnT19A+jDkG5zC3wUWAoCRXWDWcAAUQAqssfPlIdIAPJAkHbACM3gAvt4cSJ4KlKIRMuBEQFSHB+Dl4do4okUmkMlgAFwxWnJVLpWCZADcWJx9FgHFC0DJZEFOxZpPJgvA2yp+RpQjpHMZLIA5OtoFMUGq+fyKcLRRS0ZKjTK5YdwIqEuyGVzmbssUA

Expected behavior

From my point of view, I wonder if the enum values should be Global/EuOnly instead

Screenshots

None

z4kn4fein commented 2 years ago

Hi @GabrielCousin

Thank you for reaching out! The documentation you mentioned expects the enum value not as a string like 'Global', but the value accessed like DataGovernance.Global. Here, I updated your sandbox example to demonstrate. We might want to make this clearer in the documentation.

Is there a specific reason you want to use its value as a string?

GabrielCousin commented 2 years ago

Thank you for sharing more details. That makes sense! I don't need to use the value as a string, I assume I haven't understood the documentation as it was meant. Based on your feedback, I will update the addon accordingly and we can close this issue since it's not one :) Thanks again!

z4kn4fein commented 2 years ago

Thank you for sharing this addon with us! It looks exciting :) Let us know if you have further questions!