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

TypeError: Cannot read property 'hasOwnProperty' of null #31

Closed
snsyzf opened this issue Feb 6, 2021 · 7 comments
Closed

TypeError: Cannot read property 'hasOwnProperty' of null #31

snsyzf opened this issue Feb 6, 2021 · 7 comments

Comments

@snsyzf
Copy link

snsyzf commented Feb 6, 2021

D:\IdeaProjects\ml\ml-shared>npm install -g protoc-gen-ts
C:\Users\yzf\AppData\Roaming\npm\protoc-gen-ts -> C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\bin\protoc-gen-ts
npm WARN protoc-gen-ts@0.3.4 requires a peer of typescript@^4.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN protoc-gen-ts@0.3.4 requires a peer of google-protobuf@^3.13.0 but none is installed. You must install peer dependencies yourself.

  • protoc-gen-ts@0.3.4
    added 1 package in 0.267s

D:\IdeaProjects\ml\ml-shared>protoc-3.9.0-windows-x86_64.exe --ts_out=dist ./proto/game.proto
C:\Users\yzf\AppData\Roaming\npm\node_modules\typescript\lib\typescript.js:12449
return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
^

TypeError: Cannot read property 'hasOwnProperty' of null
at Object.isNodeArray (C:\Users\yzf\AppData\Roaming\npm\node_modules\typescript\lib\typescript.js:12449:22)
at createNodeArray (C:\Users\yzf\AppData\Roaming\npm\node_modules\typescript\lib\typescript.js:20812:25)
at Object.createCallExpression (C:\Users\yzf\AppData\Roaming\npm\node_modules\typescript\lib\typescript.js:22099:95)
at Object.createCall (C:\Users\yzf\AppData\Roaming\npm\node_modules\typescript\lib\typescript.js:3022:29)
at createToObject (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:49:14)
at createMessage (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:1016:5)
at processMessageDescriptor (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:1545:5)
at processProtoDescriptor (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:1590:12)
at main (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:1680:24)
at Object. (C:\Users\yzf\AppData\Roaming\npm\node_modules\protoc-gen-ts\index.js:1765:1)
--ts_out: protoc-gen-ts: Plugin failed with status code 1.

@snsyzf
Copy link
Author

snsyzf commented Feb 6, 2021

image

@NfNitLoop
Copy link

This seems to be something that's broken when running against typescript versions >= 4.0. In #32 I get similar errors if I upgrade to TSv4.

This will eventually be a breaking change that forces me to move off of protoc-gen-ts.

@thesayyn
Copy link
Owner

I'm sorry that I can't look into this right now because I don't have a computer to work on this. I have been out of work for 2 months. So it would be great if someone could send a PR for this.

NfNitLoop added a commit to NfNitLoop/protobuf that referenced this issue Mar 9, 2021
y3llowcake/protoc-gen-ts is no longer maintained:  
y3llowcake/protoc-gen-ts#2 (comment)

FWIW, neither is this one w/ a similar name: thesayyn/protoc-gen-ts:  
thesayyn/protoc-gen-ts#31 (comment)
acozzette pushed a commit to protocolbuffers/protobuf that referenced this issue Mar 9, 2021
y3llowcake/protoc-gen-ts is no longer maintained:  
y3llowcake/protoc-gen-ts#2 (comment)

FWIW, neither is this one w/ a similar name: thesayyn/protoc-gen-ts:  
thesayyn/protoc-gen-ts#31 (comment)
@dreamershl
Copy link
Contributor

I believe it is caused by this repeated field. It call with "null" parameter
image

But here it doesn't check null (if you add elements === null, and build protobuf again, the exception won't happen again)

image

@thesayyn
Copy link
Owner

thesayyn commented Mar 17, 2021

This is a great finding. I would appreciate if you can send a PR to fix this.

I would be happy to assist you on it and get it merged and released.

Also: This repository is not unmaintained. i don't even have enough resources to live right now. Let alone fix a problem when i don't have any resources.
Thanks for assuming that this project is unmaintained. @NfNitLoop

@dreamershl
Copy link
Contributor

have create the pull request for this fix.

@thesayyn
Copy link
Owner

Thanks to @dreamershl. A fix landed for this on master which will be released quickly.

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

4 participants