-
Notifications
You must be signed in to change notification settings - Fork 733
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
Add typescript typings directly into shelljs repo #736
Comments
Any thoughts on this, @nikeee? |
I don't know much about typescript types, so I don't think I could adequately review/maintain it. I'd be more than happy to work with the maintainer to get things up-to-date though. |
I will of course not object to things being done for me, but this being open source you can just let me handle this one and focus on other things. |
Sounds good! |
Ok good, I will take a look at it and leave your name as author in the typings file. Hope that is enough as attribution, @nikeee. |
The typings are currently available from DefinitelyTyped, which - as far as I understand it - is mostly a legacy thing. From there they are exported as a As I said before, the typings are now slightly out of date, not providing types for some configuration options etc. Therefore, I think we should do the right thing and bundle the updated typings directly with the library itself. |
What are the alternative options? I hesitate to merge into this repo because I don't want to take up the full maintenance burden. Is it feasible to move it into a separate repo under the shelljs org, with you and @nikeee as co-maintainers along with the rest of the org? |
Maybe. The definition file(s) only has to be packaged and published together with the rest of the npm package. |
Could you explain that for me? The typing info doesn't travel that way currently. What benefits does making the change bring? What are the consequences to packaging independently? I envision we would specify that |
I think @nikeee wanted to suggest that we could hold the definitions in a separate repo and put them together as a build step, if I am not mistaken. Not sure how that would solve the ownership problem though, at that point it seems same as bundling them together. @nfischer you could of course do that, but it is a markedly worse developer experience. You have to spend extra cycles on making sure the types package is available at the same version and the end user has to actively look for that package. They also have to make sure that at any given moment they're using compatible versions of the two packages. Having types in the same repo is clearly superior in both of these regards and provides the best possible of the box experience. In short, while I understand it is extra burden, I suggest to opt for the best possible solution even if it means more work. I think we can step up as a community and help you updating those types. In the end even if types exist completely separately I am afraid I know where users will go if they ever go out of date (issues here). |
Yeah, I see those benefits. On the other side, here are the drawbacks to keeping it in the same repo:
If we do decide to add typescript info into the repo, then we need to add official support for typescript. What would it take to get CI running the latest version of the typescript compiler? |
@nfischer I think getting TS running in a CI pipeline would not be difficult, I have a project written completely in TS and it is running tests flawlessly. The question would what tests we can run. I imagine we could put together a sample project with calls to |
Would it be possible to add an extra CI run of our test suite to compile everything with I would expect |
Can we get to some sort of a closure on this? I do not want to be mean in any way, but the typings are ~500 lines, most of it comments. I think they require only occasional updates (unless there's a big breaking change) and updating them is not too difficult. A good opportunity for contributors, I would say. Quite honestly, I think we have spent so much time discussing in this thread that the work required could easily have been just done. The typings are anyway floating out there and as evidenced by this thread, people will come here if they become out of date. It would have been so much easier for me to just send a PR in the first place. |
I'm not objecting to this, I'm not sure what response you were waiting for. Steps for implementation:
|
Any news on this? @types/shelljs seem to be pretty old, as they tell me i can only pass a callback to Edit: for those that may come here in the future, i drafted up a very rough replacement, please use carefully exec(command: string, options?: {async?: boolean, silent?: boolean, encoding?: string, shell?: string}, callback?: ExecCallback): child.ChildProcess |
@Strum355 I'm in favor of bringing typings into shelljs itself, but I need help setting up our infrastructure to actually test that code. Like I've said, I'm not a typescript user, so I need help setting this up with our travis/appveyor configs. This is basically step 1 that I outlined in #736 (comment). |
I just wanted to leave a comment to let you know that this would be a greatly appreciated feature. I totally hear what you've said about this over the past 2 years, how it increases the maintenance burden and raises the barrier of entry for contributors. The thing about typescript is that it's very easy to tell what's going on, though. Without being a typescript developer, seeing the function:
is pretty obvious. Even uncommon, decently advanced types like discriminated unions are simple enough to understand, and I personally think is easier to understand with 0 typescript background than a function with no type hints.
And now, years after the issue was created, we're starting to see that typescript isn't going anywhere. We might even be heading to a place where it's industry standard. There are types for like half of all |
@natepisarski I'm open to reviewing a PR. That said, after looking at the definitelytyped repo, I see some mistakes (e.g., That said, I can't realistically maintain these typings unless we have infra. If we can't land infra, this would be maintained by community patches. But, I don't think this is any worse than the current state? Also, if someone sends a pull request to copy the typings, please also include a copy of the definitelytyped license as per "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." |
Updated link to DefinitelyTyped typings: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/shelljs/index.d.ts |
Currently there is a separate
@types/shelljs
package, which is even slightly out of date. E.g. it does not contain theverbose
configuration option etc. Would anyone be against adding the type information directly into this package (as is the recommended way - see publishing).In case there is support for doing this, I would be happy to reach out to the typings author to ask for permission and then make the necessary updates.
The text was updated successfully, but these errors were encountered: