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

contrib/nodejs/buffer.js is outdated #3263

Closed
Mikolaj opened this issue Mar 14, 2019 · 2 comments
Closed

contrib/nodejs/buffer.js is outdated #3263

Mikolaj opened this issue Mar 14, 2019 · 2 comments

Comments

@Mikolaj
Copy link
Contributor

Mikolaj commented Mar 14, 2019

This

https://github.com/google/closure-compiler/blob/master/contrib/nodejs/buffer.js

is outdated wrt to

https://npmdoc.github.io/node-npmdoc-buffer/build/apidoc.html#apidoc.element.buffer.Buffer.alloc

resulting in JavaScript exception: TypeError: Buffer.nb is not a function error (JavaScript exception: TypeError: Buffer.$alloc$ is not a function when compiled with --debug) in my code. The following addition (a partial hack) fixed it for me:

/**
 * @param {number=} size
 * @return {Buffer}
 */
buffer.Buffer.alloc;

Note that I get the same error when using https://github.com/dcodeIO/node.js-closure-compiler-externs/blob/master/buffer.js, which is more complete, but even older and so similarly outdated, so instead I report here.

@tjgq
Copy link
Contributor

tjgq commented Mar 14, 2019

Would you like to send a PR?

@Mikolaj
Copy link
Contributor Author

Mikolaj commented Mar 14, 2019

Here you go.

@tjgq tjgq closed this as completed Mar 16, 2019
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

No branches or pull requests

2 participants