Problem with typescript + ionic2

Asked

Viewed 126 times

1

good evening, I have the following problem. I have my project in Ionic and in it I created a folder only for 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)

Finally we get to the problem

In my model folder, as you can see there is a file called all.ts in this file I export all my models to not need to import in more than one location. Below 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 care about my database-creator.ts I urge her 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 import all my classes because they have in common the static method getStructure it returns a string and I run it in the database.

Now the problem

environment-model.ts:16 Uncaught Typeerror: Cannot read Property 'prototype' of undefined__extends @environment-model.ts:16 (Anonymous Function) @color-model.ts:314 .../@addpix/[email protected]:13s @_Prelude.js:1(Anonymous Function) @_Prelude.js:111.. /scheduling-model @ all.ts:2s @_Prelude.js:1(Anonymous Function) @ _Prelude.js:15.../.. /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

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

Can anyone help me, this export way I made is the best? Why does this mistake occur? Is there a quick fix without me changing this whole structure?

Thank you!

1 answer

0

Try importing 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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.