New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix performance issue that affects flat object with multiple (thousands) keys #2004
Conversation
08038bf
to
bece215
Compare
bece215
to
df6c31c
Compare
included in v23.3.0 |
Hi! I got this error in one of the files of the node modules, do you know why? Has anyone else experienced this?
|
@quimeyruffa Which ts version are you using? And please provide a repruducible example. |
@adrai
|
@quimeyruffa I mean the TypeScript version... and btw: that's not a reproducible example... please provide a reproducible example like a github repo or similar. |
Oh, sorry, I misunderstood, the version is. "typescript": "4.3.5"
|
sorry, I'm unable to help without a reproducible example, but if the error occurs in loadLanguage, your build setup might be wrong... |
this is the build log
|
This syntax is only supported in typescript V4.5 or higher, I'll put a PR up to change the syntax here. |
Closes #1991
In this PR, I've simplified the approach for inferring the return type by directly returning the value of a specified key, rather than using conditional type to verify the presence of all
KeyWithOrdinalPlural
,KeyWithPlural
, andKey
withinRes
before returning the value.Here are the complexity results for the old and new approaches:
Old approach
Complexity: O((KeyWithPlural * N) + (KeyWithOrdinalPlural * N) + N) = O(13 * N)
New approach
Complexity: O(1) - constant time
Checklist
npm run test
Checklist (for documentation change)