Problem with typescript + ionic2

1

Good evening, I have the following problem. I have my project in ionic and in it I created a folder just for the models.

app>model (o objetos do meu sistema)
       > minha-model-a.ts
       > minha-model-b.ts
       > minha-model-c.ts
       > all.ts
app>pages (minhas páginas HTML com os seus TS e SCSS)
       > minha-home.ts
       > minha-home.html
       > minha-home.scss
app>@meupacotepersonalizado (pasta com algumas classes em comum)
       > lib.ts
       > database
           > sql-manager.ts
           > database-creator.ts

app>app.ts (arquivo app do type script)
  

Let's get down to the problem

In my model folder, as you can see there is a file named all.ts in this file, I export all my models so that I do not need to import in more than one place. Here is an example:

//arquivo all.ts da model
export {MinhaModelA} from './minha-model-a.ts';
export {MinhaModelB} from './minha-model-b.ts';
export {MinhaModelC} from './minha-model-c.ts';
  

In my app.ts I import my database-creator.ts I instantiate it and then call the method executeCreator ;

//linha que cria gera o DatabaseCreator
let dbm = new DatabaseCreator();
dbm.executeCreator();

In my DatabaseCreator is where I believe the problem occurs. Here I call all.ts and I import all my classes because they have in common the static method getStructure it returns a string and I execute in the database.

  

Now the problem

     

environment-model.ts: 16   Uncaught TypeError: Can not read property 'prototype' of undefined__extends @ ambiente-model.ts: 16   (anonymous function) @ cor-model.ts: 314   ... / @ addpix / lib @ cor-model.ts: 13s    @ _prelude.js: 1 (anonymous function) @ _prelude.js: 111 ../ scheduling-model @ all.ts: 2s @ _prelude.js: 1 (anonymous function) @ _prelude.js: / model / all @ database-creator.ts: 2s @ _prelude.js: 1 (anonymous function) @ _prelude.js: 16 ../ database-creator @ lib.ts: 6s @ _prelude.js: 1 (anonymous function) @ _prelude.js: 14 ../ alerts / lib @ lib.ts: 9s @ _prelude.js: 1 (anonymous function) @ _prelude.js: 117 ... / @ addpix / lib @ login-model.ts: 1s @ _prelude.js: 1 (anonymous function) @ _prelude.js: 130 ... / .. / @ addpix / lib @ login-page.ts: 2s @ _prelude.js: 1 (anonymous function) @ _prelude.js: 19 ../@ addpix / lib @ app.ts: 4s @ _prelude.js: 1e @ _prelude.js: 1 (anonymous function) @ _prelude.js: 1

environment-model is one of my models, but when I go on line 16 it only has } closing the class, if I remove it and put the login-model it gives the same problem. However: When I include the login-model directly by its .ts and not by all.ts it works.

Can anyone help me, is this export way I made the best one? Why does this error occur? Is there any quick fix without altering this whole structure?

Thank you!

    
asked by anonymous 12.08.2016 / 00:45

1 answer

0

Try to import without the suffix .ts

export {MinhaModelA} from './minha-model-a';

Note: If it does not work, let me know that I will delete the answer.

    
27.01.2017 / 18:09