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

Using Automapper for Ionic 3 #28

Closed
savanvadalia opened this issue May 28, 2017 · 3 comments
Closed

Using Automapper for Ionic 3 #28

savanvadalia opened this issue May 28, 2017 · 3 comments

Comments

@savanvadalia
Copy link

savanvadalia commented May 28, 2017

Hi @loedeman

Thanks for creating this wonderful library, can't wait to use it in my project.

I am creating a hybrid mobile app using ionic framework which is based on typescript and would like to use this library in my project.

  1. I would like to know what are the steps for using this library in a ionic project. I have just installed library from npm, not sure how to go forward from here
  2. Ideally, with 3rd party Javascript/Typescript libraries it has @types to be installed for intellisense support. Do you have @types for this library?
@loedeman
Copy link
Owner

Hi @savanvadalia,

You are welcome ;) , I hope you will enjoy using the library!

  1. This library is a so-called classic library, not directly created with module systems in mind (the current ones weren't there at the moment of creation :) ). In order to use AutomapperTS in your project, you should manually load the automapper-ts file ./dist/automapper.js, after which a global variable automapper will be available. I have created some kind of walkthrough about using the library in an Angular 2+ project here: Using AutoMapper in Angular2 #17 (it probably helps you as well).
  2. The @types registration should have worked, because I committed the definition file to the DefinitelyTyped repo. However, it seems that library is pruning libraries based on world usage. I am afraid AutoMapperTS is not thát heavily used, compared to libraries like Angular, JQuery etc. etc. You can manually refer to the typings though: it is located in the ./dist/automapper.d.ts folder.

I hope this helps you starting enjoying AutoMapperTS ;) !

@jboarman-ap
Copy link

jboarman-ap commented Oct 10, 2017

Hi @savanvadalia, Were you ever able to figure this out? I've gone through the steps as well and there is no typings.d.ts file to declare module 'automapper-ts';. I've tried wiring this is using typeRoots within tsconfig.json, but I'm still missing something.

For clarity, I'm getting the following error: ReferenceError: automapper is not defined

@asanchez128
Copy link

My two cents to this conversation:

In your tsconfig.json file make sure that you have the right path for your typings.d.ts file

"typeRoots": [
"node_modules/@types",
"../src/typings.d.ts"
],

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

No branches or pull requests

4 participants