Skip to content
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

fix: allow primitives in NodeJS.Process modifications #107

Merged
merged 1 commit into from Aug 10, 2018

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Aug 10, 2018

Required for: electron/electron#13542

@@ -125,7 +125,8 @@ const generateModuleDeclaration = (module, index, API) => {
if (moduleMethod.returns) {
returnType = moduleMethod.returns
// Account for methods on the process module that return a custom type/structure, we need to reference the Electron namespace to use these types
if (module.name === 'process' && moduleMethod.returns.type !== 'Object') {
if (module.name === 'process' && moduleMethod.returns.type !== 'Object' &&
typeof moduleMethod.returns.type === 'string') {
Copy link
Member

Choose a reason for hiding this comment

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

Asking for my own understanding, could you explain what this addition does wrt the Number | null documentation change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously all modifications to the process API in nodejs used complex structures as the return values. These lived in the "Electron" namespace so we blanket prefixed all the type names here so that the types were referenced correctly.

This PR adds "number" and "null" as return types which are primitives and don't exist in the electron namespace. Primitives are still type objects at this point in the code not string names. So we can just typeof check to see if we should prefix with "Electron" or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants