-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Rewrite Got in TypeScript #700
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This looks like an interesting project- I'd like to help! I can start with at least adding the TypeScript build/test steps. |
@ferdaber Yes, that would be helpful. See https://github.com/sindresorhus/is for how to do the TS setup. Should use https://github.com/sindresorhus/tsconfig and https://github.com/xojs/tslint-xo. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The TS setup is done, so now it's possible to convert to TS file-by-file. If you want to contribute, pick one or more files you think you can manage and have fun. Just rename the Note: To import a TS file into a JS file, you need to use |
Hi everyone, I'd like to help with this project, I'll be going to rewrite source/errors.js in TS. |
I would love to help rewrite the files in TypeScript, is there a specific file I can go for? |
@michaeldera Pick any For example: https://github.com/sindresorhus/got/blob/master/source/create.js |
Now working on create.js |
Started to tackle https://github.com/sindresorhus/got/blob/master/source/as-stream.js in #720 👍 |
#721 converted create.js to TypeScript. Ran into one issue and could use help with that. I added the details in the PR |
We are still looking for help getting this done. 🙌 Left to do:
When these are done, we'll need help converting the tests to TypeScript. |
fwiw and feel free to disagree but since a lot of people will consume this package in a JS project (meaning I'm just making this assumption) then tests should probably remain in JS. Consumers calling from JS into TS do not get the benefit of static type safety and accordingly the Got APIs should not make any assumptions about validity of arguments passed in. If the tests are written in TS and say an API function takes a number (and is typed as such) then when one tries to write a test that passes in, say, a string instead of a number then TS will produce a compile error. To work around the difficulty of writing tests to check the robustness of APIs against any arbitrary types of values thrown at them, one ends up doing a lot of |
I can do |
I've been doing that in other TS-written modules. It's not a big problem to write a few |
@tobenna 👍 Great |
I will give Added: Making progress: master...paulmelnikow:request-as-event-emitter-ts |
I decided to disable strict-mode for now and move the rest of the files over to TS so the TS migration would not be blocking other work. The rest of the work is moved into #758 Thanks for all the help everyone. ❤️ |
We want typings available and keeping a type definition file in sync with the actual codebase is a lot of work in itself and it's easy for them to get out of sync. I also think the codebase could benefit from being written in TypeScript, as the code is quite complex and it's easy to make subtle mistakes.
The text was updated successfully, but these errors were encountered: