Closed langpavel closed 4 years ago
Merging #166 into master will decrease coverage by
26.05%
. The diff coverage is72.88%
.
@@ Coverage Diff @@
## master #166 +/- ##
===========================================
- Coverage 100% 73.94% -26.06%
===========================================
Files 7 3 -4
Lines 181 357 +176
Branches 53 104 +51
===========================================
+ Hits 181 264 +83
- Misses 0 67 +67
- Partials 0 26 +26
Impacted Files | Coverage Δ | |
---|---|---|
dist/universal-router-generate-urls.js | 44.93% <44.93%> (ø) |
|
dist/universal-router-sync.js | 96.96% <96.73%> (ø) |
|
dist/universal-router.js | 97% <96.77%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 7cd21a1...6745a0f. Read the comment docs.
Hi! Thank you for the PR. It looks like a lot of work has been done, impressive!
Could you please explain your motivation regarding rewriting the library to TypeScript?
So far I tend to decline this changes by the following reasons:
Personally I always welcome this kind of change 👍 TS is basically more maintainable than JS. Because that's why TS exists users will indirectly get benefits though continuous package maintenance. Also I feel general trend where more packages of @types/*
will be rewritten in TS now.
Hi @frenzzy Reason is that type definitions are not complete and it is more paint to use universal-router with typescript now so I think short time about moving away. Instead I take one day to make this change. it is easier to rewrite all in typescript then trying to fix type definitions. Now I'm asking for help from community to test it and suggest enhancements. And of course, if someone can copy generated definitions and merge it in master, this will be great. Unfortunately I have no more time to work on this (week or two), help will be really welcomed!
It makes it harder to understand the source code for users which are not familiar with TS.
I'm not sure. In fact i rewrite this into typescript to understand how code works! :-) And people reading code will appreciate type annotations as semantics metadata, not having debugger in head running on 100% :-)
Correct me if I am wrong but to add type annotations it is not required to rewrite the codebase to TS, for example you can reach the same effect with JSDoc only.
Reason is that type definitions are not complete
Let's just complete them? It should be even simpler than a complete rewriting. Maybe you can generate definitions from your TS version and we will compare what we missed?
it is more paint to use universal-router with typescript
But why, what the difference?
@frenzzy
Let's just complete them? It should be even simpler than a complete rewriting.
Yeah, but adding annotations may be dangerous because they may become obsolete and useless and this is reason why I rewrite it in TS.
Adding types to existing source and let typescript really validate code is safe way how to create type definitions. I did this only to get valid
Maybe you can generate definitions from your TS version and we will compare what we missed?
Yes, this was original purpose, but when I did this, I created this PR, IMHO adopting typescript is best way to continue with project
And sorry, I'm really out of time for next 14 days. :hourglass:
I’m gonna be busy for the next two weeks. Please, test, review and may be publish as experimental prerelease. It's working. There may be only little divergences which can be easily narrowed I believe.
I created a PR with improved typings based on yours: https://github.com/kriasoft/universal-router/pull/167
it is more paint to use universal-router with typescript
Hopefully the source of the problem is eliminated and we no longer need this PR.
I am going to rethink this PR after https://github.com/pillarjs/path-to-regexp/pull/203 get released, JFYI.
I have tried to continue this work in #183 but I see problems which worrying me:
<R, C>
too many times looks wrong, but I have no idea if it is solvable.@frenzzy
noImplicitAny: true
would be a good idea to prove if the types work correctly.
Types of changes
Checklist:
This is complete rewrite in typescript
May still need some edits, but I think that we can create new branch and pre-release (I already changed version in package to
9.0.0-rc1
) Build is working, tests too, but I used base from mine starter, :gear:/ts-lib-starterTODO:
.d.ts
) to 8.x versionI need help with review, testing and feedback!
/cc @frenzzy @koistya ref #101 @pradyuman @dangmai @gytisgreitai ref #159