named-urls icon indicating copy to clipboard operation
named-urls copied to clipboard

Migrate to typescript

Open kennedykori opened this issue 3 years ago • 17 comments

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.

kennedykori avatar Jan 15 '21 21:01 kennedykori

@tricoder42 Waiting for your feedback

kennedykori avatar Jan 16 '21 17:01 kennedykori

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

tricoder42 avatar Feb 04 '21 12:02 tricoder42

Hey @tricoder42, sad to hear that. But yes, that's okay with me, I will take over the package

kennedykori avatar Feb 10 '21 14:02 kennedykori

@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?

tricoder42 avatar Apr 14 '21 10:04 tricoder42

Hello @tricoder42 , my npmjs username is kori_47

kennedykori avatar Apr 20 '21 13:04 kennedykori

Hey @kennedykori, I've invited you on npmjs. Let me know if you can public new package version

tricoder42 avatar Jun 02 '21 07:06 tricoder42

Was the ownership ever transfered? Will this PR ever be merged?

rarenatoe avatar Jul 13 '21 14:07 rarenatoe

Hey @rarenatoe, sorry for the inaction. I have been quite busy of late but I will try and work on this soon.

kennedykori avatar Jul 23 '21 13:07 kennedykori

Codecov Report

Merging #25 (17fdb8a) into master (a5cde5a) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            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.

codecov-commenter avatar Jul 25 '21 09:07 codecov-commenter

Hey @tricoder42, why did you remove semantic release from circleci?

kennedykori avatar Aug 08 '21 18:08 kennedykori

@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 avatar Aug 10 '21 10:08 tricoder42

@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.

kennedykori avatar Sep 06 '21 18:09 kennedykori

fantastic! I'll check it out!

rarenatoe avatar Sep 07 '21 00:09 rarenatoe

@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?

rarenatoe avatar Sep 07 '21 18:09 rarenatoe

Hey @rarenatoe, where are you getting that error from? Is it your IDE or you build tool?

kennedykori avatar Sep 08 '21 17:09 kennedykori

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).

rarenatoe avatar Sep 08 '21 18:09 rarenatoe

And you still get these errors even after restarting vscode? If so, please share your tsconfig.json and .eslintrc.js files.

kennedykori avatar Sep 08 '21 19:09 kennedykori