named-urls
named-urls copied to clipboard
Migrate to typescript
This PR migrates the project to typescript and is intended to address issue #7.
Care was taken to ensure that the existing behavior and functionality of the library was preserved. The only change to the library was the addition of a check on the include
method that ensures that a route object passed to the method can only contain either a string
, an object
or a toString
method as it's values. Incase the check fails, then a TypeError
is thrown.
With the change described above, all the following examples will result in a TypeError
being raised,
include("/base/", {
first: "first/",
second: () => "second/" // Only the "toString" method is allowed
})
include("/base/", {
first: "first/",
second: "second/"
third: 7 // Only a string, object or the "toString" method are allowed
})
include("/base/", {
first: "first/",
second: include("second", {
third: "third/",
fourth() {
return "fourth/" // Only the "toString" method is allowed
}
})
})
The original implementation would still have resulted in an error being thrown with the above examples, but with the new changes, the behavior is now more explicit and guaranteed to produce a consistent error message.
Fix issue #7.
@tricoder42 Waiting for your feedback
Hey @kennedykori, sorry for late response. Honesty, I no longer use this package. Would you like to take it over? I would transfer this repository and npm package to you
Hey @tricoder42, sad to hear that. But yes, that's okay with me, I will take over the package
@kennedykori Cool, thanks. I see you've already created fork, so I'll simply archive this repository. What username do you have on npmjs.org so I can transfer ownership of the package?
Hello @tricoder42 , my npmjs username is kori_47
Hey @kennedykori, I've invited you on npmjs. Let me know if you can public new package version
Was the ownership ever transfered? Will this PR ever be merged?
Hey @rarenatoe, sorry for the inaction. I have been quite busy of late but I will try and work on this soon.
Codecov Report
Merging #25 (17fdb8a) into master (a5cde5a) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #25 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 21 27 +6
Branches 0 4 +4
=========================================
+ Hits 21 27 +6
Impacted Files | Coverage Δ | |
---|---|---|
src/index.ts | 100.00% <100.00%> (ø) |
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 a5cde5a...17fdb8a. Read the comment docs.
Hey @tricoder42, why did you remove semantic release from circleci?
@kennedykori I'm not aware that I removed anything. Would it help if I simply transfer this repository to you? I've already transfered the npm package, right?
@tricoder42 @rarenatoe I released a new build on Saturday, v2.0.1. I think this PR can be closed now. And yes @tricoder42 , you can transfer the repo.
fantastic! I'll check it out!
@kennedykori could you enable the issues section of the repository? I am getting this error:
Could not find a declaration file for module 'named-urls'. '/Users/renatoalegre/Documents/BVDash/bvdash-web/node_modules/named-urls/dist/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/named-urls` if it exists or add a new declaration (.d.ts) file containing `declare module 'named-urls';`ts(7016)
If I try to import the typings through yarn add -D @types/named-urls
, I get told they don't exist.
Am I being dumb about something?
Hey @rarenatoe, where are you getting that error from? Is it your IDE or you build tool?
It's a project on vs code with typescript. I updated the dependency and tried to remove my project custom types for the dependency, but it didn't work.
I get it from the linter (eslint) and get more errors when running yarn tsc --noEmit --incremental
(but I can expand more on that later).
And you still get these errors even after restarting vscode? If so, please share your tsconfig.json
and .eslintrc.js
files.