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
The code compiles and runs OK, no problems. The issue is that when I enable the flag to export declarations as well I get this error:
Scripts/testscript.ts(20,20): error TS4025: Exported variable '_SomeClass' has or is using private name 'SomeClass'.
Expected behavior:
It is expected that the d.ts files are generated without giving me issues. Without declarations it compiles fine. The partial workaround (see below) makes the error pointless.
Notice however that I lost the @TestDec decorator doing this above (YES, I know a decorator is just a function). Not a very pleasant experience for Angular users.
Now, the following code I change SomeClassFactory to protected and it works ONLY if declarations are turned off; HOWEVER, when declarations are turned are on, this also fails with error: testscript.ts(22,20): error TS4094: Property 'SomeClassFactory' of exported class expression may not be private or protected. It's protected for a reason - I do not want people to see it in the code completion list on the exported property.
It's very frustrating to have it compile and run PERFECTLY, but then fail to generate declaration files. I keep getting blocked at every turn and it's driving me nuts lol. It's days like this I just want to switch back to pure JavaScript and save time (except then I realize all the bugs I'll probably get which would offset any time saved coding it lol ... :*( ).
The text was updated successfully, but these errors were encountered:
rjamesnw
changed the title
Cannot create declaration files from class returned from a function.
Cannot create declaration files from static factory class returned from a function.
May 18, 2018
TypeScript Version:
2.8 and 2.9
Search Terms:
Cannot create declaration files from static factory class returned from a function.
Code
(pay special attention to
class SomeClass
)The code compiles and runs OK, no problems. The issue is that when I enable the flag to export declarations as well I get this error:
Expected behavior:
It is expected that the
d.ts
files are generated without giving me issues. Without declarations it compiles fine. The partial workaround (see below) makes the error pointless.Actual behavior:
Error message (see above).
Other Details:
This works:
Notice however that I lost the
@TestDec
decorator doing this above (YES, I know a decorator is just a function). Not a very pleasant experience for Angular users.Now, the following code I change
SomeClassFactory
toprotected
and it works ONLY if declarations are turned off; HOWEVER, when declarations are turned are on, this also fails with error:testscript.ts(22,20): error TS4094: Property 'SomeClassFactory' of exported class expression may not be private or protected.
It's protected for a reason - I do not want people to see it in the code completion list on the exported property.It's very frustrating to have it compile and run PERFECTLY, but then fail to generate declaration files. I keep getting blocked at every turn and it's driving me nuts lol. It's days like this I just want to switch back to pure JavaScript and save time (except then I realize all the bugs I'll probably get which would offset any time saved coding it lol ... :*( ).
The text was updated successfully, but these errors were encountered: