feat(node): v12.7#37217
feat(node): v12.7#37217sandersn merged 3 commits intoDefinitelyTyped:masterfrom SimonSchick:feat/node-v12.7
Conversation
|
@SimonSchick Thank you for submitting this PR! 🔔 @microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @BrunoScheufler @smac89 @tellnes @Touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @samuela @kuehlein @j-oliveras @bhongy @chyzwar - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
|
A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
|
@SimonSchick The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
|
👋 Hi there! I’ve run some quick performance metrics against master and your PR. This is still an experiment, so don’t panic if I say something crazy! I’m still learning how to interpret these metrics. Let’s review the numbers, shall we? Comparison details 📊
First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt. It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place. If you have any questions or comments about me, you can ping |
types/node/dns.d.ts
Outdated
| function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<{ address: string, family: number }>; | ||
| function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>; | ||
| function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>; | ||
| function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress[]>; |
There was a problem hiding this comment.
I'm quite sure that the LookupOneOptions and LookupOptions variant is correct, see the last doc line for lookup at https://nodejs.org/dist/latest-v12.x/docs/api/dns.html#dns_dns_lookup_hostname_options_callback
Maybe the | number for the LookupOptions variant should be removed as this is better covered by the LookupOneOptions variant.
There was a problem hiding this comment.
I'm not following, please post the suggested diff.
There was a problem hiding this comment.
First variant as you suggested, second as it was before and third a combination of both:
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<{ address: string, family: number }>;
function __promisify__(hostname: string, options: LookupOptions ): Promise<{ address: string, family: number } | LookupAddress[]>;
| setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; | ||
|
|
||
| addListener(event: 'information', listener: (info: InformationEvent) => void): this; | ||
| addListener(event: string | symbol, listener: (...args: any[]) => void): this; |
There was a problem hiding this comment.
Doesn't this hide the addListener,... variants from base class? sure, there is the generic variant so nothing is broken but now only the information event is typed.
On the other hand copy pasting all the other definitions is also not nice...
There was a problem hiding this comment.
Well, that's a problem, not only in this place but already existing ones as well.
I will use declaration merging instead.
There was a problem hiding this comment.
Which.. apparently doesn't work anymore, this is going to become annoying.
There was a problem hiding this comment.
With newer typescript versions this could be improved to define lists of types and reuse them at several places... but we have to stick on 2.0/2.1...
|
@rbuckton any suggestions on how to handle overloads with inheritance? |
|
@Flarna I will be n/a for a day or 2, I gave you push rights to my fork for now, feel free to fix things as you see fit. |
|
@SimonSchick The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
add http.response.writableFinished add tests fix lint
|
I committed some fixes. I tried also to add I have not touched the events of |
Copy them all, tbh. Overloads don't inherit well - you either get all of them or none. |
|
@weswigham that's not really a sustainable solution, it solves the problem for now but probably creates more later and I'm curious if the TS/DT team knows a solution to that :) |
|
Updated numbers for you here from 53d63e4: Comparison details 📊
First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt. It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place. |
Yeah, I know. You can do something like |
|
I've had a number of discussions with @DanielRosenwasser about ways to improve typing for NodeJS (and DOM) events, but we haven't settled on a good solution yet. |
Flarna
left a comment
There was a problem hiding this comment.
events from base class of ClientRequest need to be copied.
|
@SimonSchick One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you! |
|
@Flarna I think one option here would be to extract all event into separate interfaces and then decl merge them together, this way we could keep those reusable, still kinda hacky. |
|
@SimonSchick I just copy pasted once again and added also the other events documented for |
|
I have the feeling that I self approved this PR now but I have no idea how to avoid this... |
|
Updated numbers for you here from 83dd75a: Comparison details 📊
First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt. It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place. |
|
@Flarna so is this ready to go? I got confused by your "self-approved" comment whether you meant to sign off or not. |
|
@sandersn Yes, it's ready. Thanks! |
|
I just published |
| const x = 1; | ||
| const y = 1; | ||
|
|
||
| readline.cursorTo(strm, x); |
There was a problem hiding this comment.
This line was in place to test the change in #17684, which has now been undone.
Current Node.js still appears to accept y as an optional parameter, but they also never updated the docs. (Doesn't look like the PR was ever created.)
There was a problem hiding this comment.
I think we should start with a PR for node otherwise such mismatches will confuse people again and again. Maybe I find some time the next days to do this.
There was a problem hiding this comment.
For the record, I have just opened #37630. Hope this helps!
* feat(node): v12.7 * correct dns.lookup add http.response.writableFinished add tests fix lint * add events to http.ClientRequest
Please fill in this template.
npm test.)npm run lint package-name(ortscif notslint.jsonis present).Select one of these and delete the others:
If changing an existing definition:
tslint.jsoncontaining{ "extends": "dtslint/dt.json" }.Also:
Fixes #37035