You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript Version: 2.1.4
Static variables class variables of another class in the same module cannot be instantiated before the class has been declared
Swapping around kind of works but if you want class DoesntWork to inherit Issue Issue needs to be declared first
Expected behavior:
No error and able to reference Issue.X
Issue.X = new DoesntWork needs to be dumped at either the end of the js or after where DoesntWork is declared.
Actual behavior:
Error is raised,
Uncaught TypeError: DoesntWork is not a constructor (chrome)
Object doesn't support this action (edge)
etc etc
The text was updated successfully, but these errors were encountered:
This is not a duplicate as #12673 as that is suggesting blocking using b before it is defined. What I am essentually trying to acheive is have a 'static readonly 'null instance'' the suggestion above will not allow exporting a hidden class which inherits from Issue and impements a 'null instance' of issue if that makes sense??
exportclassIssue{staticreadonlyX=newDoesntWork();SomeMethod(){// Do something }}classDoesntWorkextendsIssue{SomeMethod(){// Do Nothing }}
TypeScript Version: 2.1.4
Static variables class variables of another class in the same module cannot be instantiated before the class has been declared
for example
this is because of where X is being set in the generated javascript
Issue.X should be set after DoesntWork is defined rather than before
If I swap the order of definition, it works, i.e.
Generated JS
Swapping around kind of works but if you want class DoesntWork to inherit Issue Issue needs to be declared first
Expected behavior:
No error and able to reference Issue.X
Issue.X = new DoesntWork needs to be dumped at either the end of the js or after where DoesntWork is declared.
Actual behavior:
Error is raised,
Uncaught TypeError: DoesntWork is not a constructor (chrome)
Object doesn't support this action (edge)
etc etc
The text was updated successfully, but these errors were encountered: