typescript - Should default "get" accessor descriptor (with defined "set" accessor descriptor) have type "undefined"? -


if @ example:

class myclass {                                                                  private _myvar: string;                                                        public constructor() {                                                          this._myvar = 'hello world!';                                               }                                                                              public set myvar(value: string) {                                               this._myvar = value;                                                        }                                                                            }                                                                              const myobj = new myclass();                                                   const othervar: string = myobj.myvar; 

there no error produced, should there be?

the class doesn't have get key myvar property, defaults undefined, yet typescript compiler doesn't pick on , says last othervar assignment fine.

shouldn't last assignment error out?

issue had been raised here: https://github.com/microsoft/typescript/issues/11596


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -