angular: ngc not working with static symbols used with Angular 1 code (ngUpgrade)
I’m submitting a …
[x] bug report
Current behavior I’m getting this error:
$ ./node_modules/.bin/ngc
Failed on type {"filePath":"/.../testApp/app/scripts/core/sectionhelp.component.ts","name":"SectionHelpComponent"} with error Error: Error encountered resolving symbol values statically. Qualified type names not supported (position 18:53 in the original .ts file), resolving symbol SectionHelpComponent in /.../testApp/app/scripts/core/section-help.component.ts
Error: Error encountered resolving symbol values statically. Qualified type names not supported (position 18:53 in the original .ts file), resolving symbol SectionHelpComponent in /.../testApp/app/scripts/core/section-help.component.ts
at simplifyInContext (/.../testApp/node_modules/@angular/compiler-cli/src/static_reflector.js:409:23)
at StaticReflector.simplify (/.../testApp/node_modules/@angular/compiler-cli/src/static_reflector.js:412:22)
at StaticReflector.parameters (/.../testApp/node_modules/@angular/compiler-cli/src/static_reflector.js:85:47)
at CompileMetadataResolver.getDependenciesMetadata (/.../testApp/node_modules/@angular/compiler/src/metadata_resolver.js:224:86)
at CompileMetadataResolver.getTypeMetadata (/.../testApp/node_modules/@angular/compiler/src/metadata_resolver.js:173:26)
at CompileMetadataResolver.getDirectiveMetadata (/.../testApp/node_modules/@angular/compiler/src/metadata_resolver.js:136:28)
at CompileMetadataResolver.maybeGetDirectiveMetadata (/.../testApp/node_modules/@angular/compiler/src/metadata_resolver.js:158:25)
at CodeGenerator.readComponents (/.../testApp/node_modules/@angular/compiler-cli/src/codegen.js:62:39)
at generateOneFile (/.../testApp/node_modules/@angular/compiler-cli/src/codegen.js:100:38)
at Array.map (native)
Compilation failed
On this code:
@Component({
selector: 'section-help',
templateUrl: 'scripts/core/section-help.component.html',
directives: [CORE_DIRECTIVES],
pipes: [TranslateNG1Pipe],
})
export class SectionHelpComponent implements OnInit {
private language:string;
private locationHash:string;
private loading:boolean;
private helpList:any[];
private glossaryList:any[];
constructor(@Inject('$timeout') private $timeout:ng.ITimeoutService,
@Inject('$location') private $location:ng.ILocationService,
private HelpService:HelpService) {
}
If I remove the types from Angular 1 it successfully compiles using ngc
:
constructor(@Inject('$timeout') private $timeout,
@Inject('$location') private $location,
private HelpService:HelpService) {
}
This code works perfectly compiling using tsc
in dynamic mode.
Expected/desired behavior Be able to compile using Angular 1 types and custom interfaces.
Please tell us about your environment:
- Angular version: 2.0.0-rc.3
- Language: TypeScript 1.9
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (9 by maintainers)
Commits related to this issue
- fix(compiler): Ignore references to declared modules and unneeded types Fixes: #9670 — committed to chuckjaz/angular by chuckjaz 8 years ago
- fix(compiler): Ignore references to declared modules and unneeded types Fixes: #9670 — committed to chuckjaz/angular by chuckjaz 8 years ago
- fix(compiler): Ignore references to declared modules and unneeded types Fixes: #9670 — committed to chuckjaz/angular by chuckjaz 8 years ago
- fix(compiler): Ignore references to declared modules and unneeded types Fixes: #9670 — committed to chuckjaz/angular by chuckjaz 8 years ago
- fix(compiler): Ignore references to declared modules and unneeded types Fixes: #9670 — committed to chuckjaz/angular by chuckjaz 8 years ago
- fix(compiler): Ignore references to declared modules and unneeded types (#9776) Fixes: #9670 — committed to angular/angular by chuckjaz 8 years ago
I’m getting this error 😦
@marcalj No problem. I will commit this as is. It seems to be fixing the underlying problem.
@sod Thanks for verifying this. The error with the ROUTER_PROVIDERS is known and we should fix that soon. The current way ROUTER_PROVIDERS is initialized will not work with the offline compiler but the fix is relatively simple.
@marcalj Not easily. Could you use nvm to change to 5.5?