waitingsong / node-win32-api

win32 api
MIT License
413 stars 53 forks source link

way return '' => return; #70

Closed LFF5644 closed 3 weeks ago

LFF5644 commented 1 year ago

https://github.com/waitingsong/node-win32-api/blob/22239e83db6f3725ce95677f3f23ae25a1991899/packages/win32-api/demo/create_window.ts#L165-L165 way you use return ''; you can also use return;

waitingsong commented 1 year ago

Because declare return type of changeTitle() is string

https://github.com/waitingsong/node-win32-api/blob/22239e83db6f3725ce95677f3f23ae25a1991899/packages/win32-api/demo/create_window.ts#L154

L3P3 commented 1 year ago

What string is it returning? What is the meaning of the returned string?

waitingsong commented 1 year ago

It should return new title string , but not implemeted yet ....

    else {
      // const tt = getTitle(handle)
      return ''
    }
L3P3 commented 1 year ago

What would be the point of returning the value of a setter? I think setters should always return nothing or maybe success/failure if applicable. Or are you referencing something?

waitingsong commented 1 year ago

The new title may not equal to the input value completely, due to length, case or some thing others. Then developer can validate action result strictly, not only title write.

L3P3 commented 1 year ago

I see. If it was my library, I would offer a getTitle but its not, go for it. :sweat_smile: