angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Using the --aot flag with ts files using the import * as Xx from 'lib' throws an exception during build/serve.

Open wendelstam opened this issue 10 years ago • 3 comments

angular-cli: 1.0.0-beta.19-3
node: 6.9.1
os: win32 x64

Using the --aot flag ts files using the import * as Xx from 'lib' throws an exception during build/serve. When explicitly defining all imports it works. If I add the second line below I can still us the Rx.Observable etc. in the code but.

Is this expected or is it a bug? Not sure how the tree shaking is meant to interpret the import * as statments.

import * as Rx from 'rxjs'; // Error
import { Observable, Subject } from 'rxjs'; // Works

The error I was getting was:

Return type of public method from exported class has or is using name 'Observable' from external module "[project path here]/node_modules/rxjs/Observable" but cannot be named.)

wendelstam avatar Oct 29 '16 15:10 wendelstam

I get this error too. It has to do with the typings. I think it happens because Typescript is trying to export declarations for the source files. I initially got about 20 of these errors and had to explicitly state typings that were implicit.

E.g. changing: isAuthenticated = authenticationLib.isAuthenticated$ to isAuthenticated: Observable<boolean> = authenticationLib.isAuthenticated$

skovmand avatar Oct 30 '16 13:10 skovmand

This seems to be fixed in newer versions of the CLI.

filipesilva avatar May 22 '17 13:05 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.