Type language as string, not a fixed union - #5
Merged
Conversation
added 2 commits
August 14, 2026 22:13
The widget resolves the language against the translations it ships and uses English for anything else, so no code is invalid. The 'en'|'cs'|'sk' union made TypeScript reject valid values and would need editing for every language added. Also bumps package.json to 0.3.0 — the 0.3.0 tag was cut without it.
Unknown language falls back to the browser language first, then English -- not straight to English.
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
StromcomConfOptions.languageis typed'en' | 'cs' | 'sk' | null. The widget does not validate against that set — it resolves the language against the translation bundles it ships and uses English for anything else. So the union makes TypeScript reject values that work fine, and it needs editing every time a language is added.What
languageisstring | nullonStromcomConfOptions, with the fallback behaviour documented instead of encoded in the type. Same wording onStromcomProviderProps.languageand in both README prop tables. No runtime change.package.jsonbumped to0.3.0. The0.3.0tag points at the merge of Add language prop to StromcomConf #4, but the version bump never landed — master still said0.2.0. Worth a look: npmlatestis still0.1.0, so neither0.2.0nor0.3.0appears to have been published.Tests
32 tests passing;
lintandformat:checkclean.