Skip to content

Add string option for vm.runIn*Context methods in Node.js typing - #24798

Merged
mhegazy merged 4 commits into
DefinitelyTyped:masterfrom
mohsen1:fix-runInThisContext
Apr 10, 2018
Merged

mhegazy merged 4 commits into
DefinitelyTyped:masterfrom
mohsen1:fix-runInThisContext

Conversation

@mohsen1

@mohsen1 mohsen1 commented Apr 8, 2018 •

Copy link
Copy Markdown
Contributor

This is part of my work at webpack/webpack#6862

Link to code

https://github.com/nodejs/node/blob/77b52fd58f7398a81999c81afd21fe2e156c0766/lib/vm.js#L284-L286

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: <>
  • Increase the version number in the header if appropriate.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.

Comment thread types/node/index.d.ts
export function isContext(sandbox: Context): boolean;
export function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions): any;
export function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
/** @deprecated */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mohsen1 mohsen1 mentioned this pull request Apr 8, 2018
27 tasks done
@typescript-bot typescript-bot added the Popular package This PR affects a popular package (as counted by NPM download counts). label Apr 8, 2018
@typescript-bot

typescript-bot commented Apr 8, 2018 •

Copy link
Copy Markdown
Contributor

@mohsen1 Thank you for submitting this PR!

🔔 @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @ajafff - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot

Copy link
Copy Markdown
Contributor

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

@Flarna

Flarna commented Apr 8, 2018

Copy link
Copy Markdown
Contributor

Even this is in source code it's not in API documentation. I think this is NodeJS 0.10 API compatibility which had only string but no options object in API.
I'm not sure if we should rely on this undocumented compat code to be in code forever. It would be nice to add also a PR towards NodeJs doc. Depending on the result if this PR we would have a clear statement.

On the other hand it is in code now and also on master so for NodeJs 8 and 9 it will be for sure not removed....

@mohsen1

mohsen1 commented Apr 8, 2018

Copy link
Copy Markdown
Contributor Author

The type definition is marking existing and working core as incorrect. The definition should reflect the API even if not documented

@Flarna Flarna left a comment

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.

Could you please add the test also for v9?

@Flarna

Flarna commented Apr 9, 2018

Copy link
Copy Markdown
Contributor

I still think that a PR towards NodeJS doc would be nice (like it was done for fs in nodejs/node#1806) but this is not part of this PR.

@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @Flarna - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate?

@typescript-bot

Copy link
Copy Markdown
Contributor

A definition author 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!

@mhegazy
mhegazy merged commit 5193c7c into DefinitelyTyped:master Apr 10, 2018
KSXGitHub pushed a commit to KSXGitHub/DefinitelyTyped that referenced this pull request May 12, 2018
…initelyTyped#24798)

* Add string option for vm.runIn*Context methods

* Add test

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

Labels

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.

4 participants