Migrate @fluent/langneg to TypeScript#462
Conversation
| import filterMatches from "./matches"; | ||
| import {filterMatches} from "./matches"; | ||
|
|
||
| function GetOption(options, property, type, values, fallback) { |
There was a problem hiding this comment.
I removed this function because I don't think the implementation of @fluent/langneg needs to be 100% defensive. For TypeScript consumers, TS already gives us some of those guaranties. For non-TS consumers, we don't usually verify all inputs in other @fluent packages as thoroughly as this function did it.
| resolvedReqLoc, | ||
| resolvedAvailLoc, strategy | ||
| Array.from(Object(requestedLocales)).map(String), | ||
| Array.from(Object(availableLocales)).map(String), |
There was a problem hiding this comment.
I'm tempted to remove the string and array normalization here as well, because again, I think we can make reasonable assumptions about the quality of the input. There are tests which fail if I do that, however.
| for (const strategy in data) { | ||
| for (const groupName in data[strategy]) { | ||
| const group = data[strategy][groupName]; | ||
| test(`${strategy} - ${groupName}`, () => { |
There was a problem hiding this comment.
I moved the test call into the nested for loop so that each case is run as a separate Mocha test, resulting in better test summary and error logging.
|
@zbraniecki Would you have a moment to review this? Other than adding types, I also made a few small changes to the implementation to make it a bit less defensive. |
|
Thanks for the review, @zbraniecki! |
See #376.