Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace 'angular' has no exported member 'resource' #6

Closed
tuxracer opened this issue May 24, 2017 · 6 comments
Closed

Namespace 'angular' has no exported member 'resource' #6

tuxracer opened this issue May 24, 2017 · 6 comments
Assignees
Labels

Comments

@tuxracer
Copy link

tuxracer commented May 24, 2017

ERROR in [at-loader] ./node_modules/ngimport/index.d.ts:28:39 
    TS2694: Namespace 'angular' has no exported member 'resource'.

https://github.com/bcherny/ngimport/blob/master/index.ts#L80 $resource = $i.get('$resource') as angular.resource.IResourceService seems to be failing

If instead of https://github.com/bcherny/ngimport/blob/master/index.ts#L2 import 'angular-resource' you instead copy/paste the contents of angular-resource into that file then it suddenly worked. Somehow that import isn't working.

image

@bcherny
Copy link
Owner

bcherny commented May 24, 2017

Hi @tuxracer! Unfortunately I can't repro this issue in a sandbox.

Can you try:

  • Deleting your node_modules folder, and rerunning npm i
  • Ensuring that your app doesn't depend on a version of angular, angular-resource, @types/angular, etc. that is incompatible with the version ngimport depends on

If that doesn't work, can you post your:

  • TSC version
  • package.json

Or better yet, a full repro case.

@bcherny bcherny self-assigned this May 24, 2017
@bcherny bcherny added the bug label May 24, 2017
@bcherny
Copy link
Owner

bcherny commented Jun 3, 2017

Closing for lack of activity. @tuxracer feel free to reopen if you can add a repro case.

@bcherny bcherny closed this as completed Jun 3, 2017
@agos
Copy link

agos commented Nov 20, 2017

Seeing the same with TSC 2.6.1 and the following versions in package.json:

    "angular": "1.6.6",
    "@types/angular": "1.6.6",
    "@types/angular-resource": "^1.5.14",
    "angular-resource": "^1.6.6",
    "ngimport": "^0.8.0",

@bcherny
Copy link
Owner

bcherny commented Nov 20, 2017

@agos Could you post a self-contained repro case as a zip, or on https://stackblitz.com/?

@bcherny bcherny reopened this Nov 20, 2017
@agos
Copy link

agos commented Nov 21, 2017

I explored more, and got it working modifying the above into:

    "angular": "1.6.6",
    "@types/angular": "^1.6.39",
    "angular-resource": "^1.6.6",
    "ngimport": "^0.8.0",

the issue was with the pinned version of the angular types, leading to two different version of the types present at the same time

@bcherny
Copy link
Owner

bcherny commented Jan 29, 2018

@agos @tuxracer I removed the dependency on ngresource in 1.0.0.

If you need ngResource in the future, I moved it to its own package ngimport-ngresource.

In the meantime, I hope this solves the issue you guys have been having.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants