Skip to content

Add new types for Node.js v10.0.0#25269

Merged
rbuckton merged 1 commit intomasterfrom
node10
Apr 26, 2018
Merged

Add new types for Node.js v10.0.0#25269
rbuckton merged 1 commit intomasterfrom
node10

Conversation

@rbuckton
Copy link
Copy Markdown
Collaborator

If changing an existing definition:

This adds support for "fs/promises" as well as a number of new additions, soft deprecations, and outright removals.

@typescript-bot typescript-bot added New Definition This PR creates a new definition package. Popular package This PR affects a popular package (as counted by NPM download counts). Awaiting reviewer feedback labels Apr 24, 2018
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Apr 24, 2018

@rbuckton Thank you for submitting this PR!

Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes.

In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day!

Comment thread types/node/index.d.ts
export function puts(...param: any[]): void;
/** @deprecated since v0.11.3 - use `console.log()` instead. */
export function print(...param: any[]): void;
/** @deprecated since v0.11.3 - use a third party module instead. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, log isn't console.log?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it wraps console.log and adds a timestamp. However, it's a soft deprecation (no runtime warning), but its marked "deprecated" in the docs.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Apr 24, 2018

@rbuckton 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!

@fluggo
Copy link
Copy Markdown
Contributor

fluggo commented Apr 24, 2018

You've run into the same problem I've run into on #25263, a bunch of broken definitions elsewhere in the tree.

@rbuckton
Copy link
Copy Markdown
Collaborator Author

@fluggo, those errors are due to a change in the behavior of keyof in TS 2.9 and should be addressed by #25271

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Apr 25, 2018

@rbuckton 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!

@ghost
Copy link
Copy Markdown

ghost commented Apr 25, 2018

It looks like the large number of packages depending on @types/node causes the build to take over 10 minutes -- I would just merge this once you've received enough reviews, and we'll see if there are new errors in the nightly builds.

@rbuckton
Copy link
Copy Markdown
Collaborator Author

Is there a timeout we can increase temporarily?

@ghost
Copy link
Copy Markdown

ghost commented Apr 25, 2018

This may be due to a recent types-publisher change and not to the number of packages -- see microsoft/types-publisher#452

UPDATE: Looks like that was it, tests pass now.

@rbuckton rbuckton merged commit b6a6db1 into master Apr 26, 2018
@rbuckton rbuckton deleted the node10 branch April 26, 2018 04:43
@DanielRosenwasser
Copy link
Copy Markdown
Member

DanielRosenwasser commented Apr 26, 2018

👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏
👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏  Awesome Work!  👏 👏 👏 👏 👏 👏 👏 👏 👏
👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏 👏

Comment thread types/node/index.d.ts
username: string;
toString(): string;
toJSON(): string;
global {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question just for interest: what is the reason to move this into global here?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25342

I'm working on build failures caused by 10.0.0 being pulled in as a transitive dependency and I wonder whether the decision to move these definitions into the global namespace is causing the collision here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was definitely made a global because node now places it into the global scope (which is problematic if node is in the same compilation as the dom lib), this really needs microsoft/TypeScript#15780 (and for the URL constructor to be in its own lib) for it to be handled well.

Copy link
Copy Markdown
Collaborator Author

@rbuckton rbuckton Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weswigham I'm apprehensive that even microsoft/TypeScript#15780 will help since the WHATWG URL implementation has a subtly different API surface in the DOM vs. NodeJS. Rather, I think this will necessitate switching the definition of URL and URLSearchParams in DOM to use the same split interface (instance vs. constructor) approach we use for Object, Number, etc. so that the declarations can merge.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reverting this specific change in #25356 for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this same type of problem exists for setTimeout.

The implementation is subtly different in the DOM vs Node.js, specifically the return type. https://nodejs.org/dist/latest-v10.x/docs/api/timers.html

Somehow TypeScript is able to handle this scenario, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Definition This PR creates a new definition package. Popular package This PR affects a popular package (as counted by NPM download counts).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants