Giter VIP home page Giter VIP logo

ionic-example's Introduction

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used with TypeScript and JavaScript (ES2021). Its goal is to always support the latest JavaScript features and provide additional features that help you to develop any kind of application that uses databases - from small applications with a few tables to large-scale enterprise applications with multiple databases.

TypeORM supports both Active Record and Data Mapper patterns, unlike all other JavaScript ORMs currently in existence, which means you can write high-quality, loosely coupled, scalable, maintainable applications in the most productive way.

TypeORM is highly influenced by other ORMs, such as Hibernate, Doctrine and Entity Framework.

Features

  • Supports both DataMapper and ActiveRecord (your choice).
  • Entities and columns.
  • Database-specific column types.
  • Entity manager.
  • Repositories and custom repositories.
  • Clean object-relational model.
  • Associations (relations).
  • Eager and lazy relations.
  • Uni-directional, bi-directional, and self-referenced relations.
  • Supports multiple inheritance patterns.
  • Cascades.
  • Indices.
  • Transactions.
  • Migrations and automatic migrations generation.
  • Connection pooling.
  • Replication.
  • Using multiple database instances.
  • Working with multiple database types.
  • Cross-database and cross-schema queries.
  • Elegant-syntax, flexible and powerful QueryBuilder.
  • Left and inner joins.
  • Proper pagination for queries using joins.
  • Query caching.
  • Streaming raw results.
  • Logging.
  • Listeners and subscribers (hooks).
  • Supports closure table pattern.
  • Schema declaration in models or separate configuration files.
  • Supports MySQL / MariaDB / Postgres / CockroachDB / SQLite / Microsoft SQL Server / Oracle / SAP Hana / sql.js.
  • Supports MongoDB NoSQL database.
  • Works in NodeJS / Browser / Ionic / Cordova / React Native / NativeScript / Expo / Electron platforms.
  • TypeScript and JavaScript support.
  • ESM and CommonJS support.
  • Produced code is performant, flexible, clean, and maintainable.
  • Follows all possible best practices.
  • CLI.

And more...

With TypeORM your models look like this:

import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    firstName: string

    @Column()
    lastName: string

    @Column()
    age: number
}

And your domain logic looks like this:

const userRepository = MyDataSource.getRepository(User)

const user = new User()
user.firstName = "Timber"
user.lastName = "Saw"
user.age = 25
await userRepository.save(user)

const allUsers = await userRepository.find()
const firstUser = await userRepository.findOneBy({
    id: 1,
}) // find by id
const timber = await userRepository.findOneBy({
    firstName: "Timber",
    lastName: "Saw",
}) // find by firstName and lastName

await userRepository.remove(timber)

Alternatively, if you prefer to use the ActiveRecord implementation, you can use it as well:

import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm"

@Entity()
export class User extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    firstName: string

    @Column()
    lastName: string

    @Column()
    age: number
}

And your domain logic will look this way:

const user = new User()
user.firstName = "Timber"
user.lastName = "Saw"
user.age = 25
await user.save()

const allUsers = await User.find()
const firstUser = await User.findOneBy({
    id: 1,
})
const timber = await User.findOneBy({
    firstName: "Timber",
    lastName: "Saw"
})

await timber.remove()

Installation

  1. Install the npm package:

    npm install typeorm --save

  2. You need to install reflect-metadata shim:

    npm install reflect-metadata --save

    and import it somewhere in the global place of your app (for example in app.ts):

    import "reflect-metadata"

  3. You may need to install node typings:

    npm install @types/node --save-dev

  4. Install a database driver:

    • for MySQL or MariaDB

      npm install mysql --save (you can install mysql2 instead as well)

    • for PostgreSQL or CockroachDB

      npm install pg --save

    • for SQLite

      npm install sqlite3 --save

    • for Microsoft SQL Server

      npm install mssql --save

    • for sql.js

      npm install sql.js --save

    • for Oracle

      npm install oracledb --save

      To make the Oracle driver work, you need to follow the installation instructions from their site.

    • for SAP Hana

      npm install @sap/hana-client
      npm install hdb-pool
      

      SAP Hana support made possible by the sponsorship of Neptune Software.

    • for Google Cloud Spanner

      npm install @google-cloud/spanner --save
      

      Provide authentication credentials to your application code by setting the environment variable GOOGLE_APPLICATION_CREDENTIALS:

      # Linux/macOS
      export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"
      
      # Windows
      set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH
      
      # Replace KEY_PATH with the path of the JSON file that contains your service account key.

      To use Spanner with the emulator you should set SPANNER_EMULATOR_HOST environment variable:

      # Linux/macOS
      export SPANNER_EMULATOR_HOST=localhost:9010
      
      # Windows
      set SPANNER_EMULATOR_HOST=localhost:9010
    • for MongoDB (experimental)

      npm install mongodb@^5.2.0 --save

    • for NativeScript, react-native and Cordova

      Check documentation of supported platforms

    Install only one of them, depending on which database you use.

TypeScript configuration

Also, make sure you are using TypeScript version 4.5 or higher, and you have enabled the following settings in tsconfig.json:

"emitDecoratorMetadata": true,
"experimentalDecorators": true,

You may also need to enable es6 in the lib section of compiler options, or install es6-shim from @types.

Quick Start

The quickest way to get started with TypeORM is to use its CLI commands to generate a starter project. Quick start works only if you are using TypeORM in a NodeJS application. If you are using other platforms, proceed to the step-by-step guide.

To create a new project using CLI, run the following command:

npx typeorm init --name MyProject --database postgres

Where name is the name of your project and database is the database you'll use. Database can be one of the following values: mysql, mariadb, postgres, cockroachdb, sqlite, mssql, sap, spanner, oracle, mongodb, cordova, react-native, expo, nativescript.

This command will generate a new project in the MyProject directory with the following files:

MyProject
├── src                   // place of your TypeScript code
│   ├── entity            // place where your entities (database models) are stored
│   │   └── User.ts       // sample entity
│   ├── migration         // place where your migrations are stored
│   ├── data-source.ts    // data source and all connection configuration
│   └── index.ts          // start point of your application
├── .gitignore            // standard gitignore file
├── package.json          // node module dependencies
├── README.md             // simple readme file
└── tsconfig.json         // TypeScript compiler options

You can also run typeorm init on an existing node project, but be careful - it may override some files you already have.

The next step is to install new project dependencies:

cd MyProject
npm install

After you have all dependencies installed, edit the data-source.ts file and put your own database connection configuration options in there:

export const AppDataSource = new DataSource({
    type: "postgres",
    host: "localhost",
    port: 5432,
    username: "test",
    password: "test",
    database: "test",
    synchronize: true,
    logging: true,
    entities: [Post, Category],
    subscribers: [],
    migrations: [],
})

Particularly, most of the time you'll only need to configure host, username, password, database and maybe port options.

Once you finish with configuration and all node modules are installed, you can run your application:

npm start

That's it, your application should successfully run and insert a new user into the database. You can continue to work with this project and integrate other modules you need and start creating more entities.

You can generate an ESM project by running npx typeorm init --name MyProject --database postgres --module esm command.

You can generate an even more advanced project with express installed by running npx typeorm init --name MyProject --database mysql --express command.

You can generate a docker-compose file by running npx typeorm init --name MyProject --database postgres --docker command.

Step-by-Step Guide

What are you expecting from ORM? First of all, you are expecting it will create database tables for you and find / insert / update / delete your data without the pain of having to write lots of hardly maintainable SQL queries. This guide will show you how to set up TypeORM from scratch and make it do what you are expecting from an ORM.

Create a model

Working with a database starts with creating tables. How do you tell TypeORM to create a database table? The answer is - through the models. Your models in your app are your database tables.

For example, you have a Photo model:

export class Photo {
    id: number
    name: string
    description: string
    filename: string
    views: number
    isPublished: boolean
}

And you want to store photos in your database. To store things in the database, first, you need a database table, and database tables are created from your models. Not all models, but only those you define as entities.

Create an entity

Entity is your model decorated by an @Entity decorator. A database table will be created for such models. You work with entities everywhere in TypeORM. You can load/insert/update/remove and perform other operations with them.

Let's make our Photo model an entity:

import { Entity } from "typeorm"

@Entity()
export class Photo {
    id: number
    name: string
    description: string
    filename: string
    views: number
    isPublished: boolean
}

Now, a database table will be created for the Photo entity and we'll be able to work with it anywhere in our app. We have created a database table, however, what table can exist without columns? Let's create a few columns in our database table.

Adding table columns

To add database columns, you simply need to decorate an entity's properties you want to make into a column with a @Column decorator.

import { Entity, Column } from "typeorm"

@Entity()
export class Photo {
    @Column()
    id: number

    @Column()
    name: string

    @Column()
    description: string

    @Column()
    filename: string

    @Column()
    views: number

    @Column()
    isPublished: boolean
}

Now id, name, description, filename, views, and isPublished columns will be added to the photo table. Column types in the database are inferred from the property types you used, e.g. number will be converted into integer, string into varchar, boolean into bool, etc. But you can use any column type your database supports by explicitly specifying a column type into the @Column decorator.

We generated a database table with columns, but there is one thing left. Each database table must have a column with a primary key.

Creating a primary column

Each entity must have at least one primary key column. This is a requirement and you can't avoid it. To make a column a primary key, you need to use the @PrimaryColumn decorator.

import { Entity, Column, PrimaryColumn } from "typeorm"

@Entity()
export class Photo {
    @PrimaryColumn()
    id: number

    @Column()
    name: string

    @Column()
    description: string

    @Column()
    filename: string

    @Column()
    views: number

    @Column()
    isPublished: boolean
}

Creating an auto-generated column

Now, let's say you want your id column to be auto-generated (this is known as auto-increment / sequence / serial / generated identity column). To do that, you need to change the @PrimaryColumn decorator to a @PrimaryGeneratedColumn decorator:

import { Entity, Column, PrimaryGeneratedColumn } from "typeorm"

@Entity()
export class Photo {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    name: string

    @Column()
    description: string

    @Column()
    filename: string

    @Column()
    views: number

    @Column()
    isPublished: boolean
}

Column data types

Next, let's fix our data types. By default, the string is mapped to a varchar(255)-like type (depending on the database type). The number is mapped to an integer-like type (depending on the database type). We don't want all our columns to be limited varchars or integers. Let's setup the correct data types:

import { Entity, Column, PrimaryGeneratedColumn } from "typeorm"

@Entity()
export class Photo {
    @PrimaryGeneratedColumn()
    id: number

    @Column({
        length: 100,
    })
    name: string

    @Column("text")
    description: string

    @Column()
    filename: string

    @Column("double")
    views: number

    @Column()
    isPublished: boolean
}

Column types are database-specific. You can set any column type your database supports. More information on supported column types can be found here.

Creating a new DataSource

Now, when our entity is created, let's create index.ts file and set up our DataSource there:

import "reflect-metadata"
import { DataSource } from "typeorm"
import { Photo } from "./entity/Photo"

const AppDataSource = new DataSource({
    type: "postgres",
    host: "localhost",
    port: 5432,
    username: "root",
    password: "admin",
    database: "test",
    entities: [Photo],
    synchronize: true,
    logging: false,
})

// to initialize the initial connection with the database, register all entities
// and "synchronize" database schema, call "initialize()" method of a newly created database
// once in your application bootstrap
AppDataSource.initialize()
    .then(() => {
        // here you can start to work with your database
    })
    .catch((error) => console.log(error))

We are using Postgres in this example, but you can use any other supported database. To use another database, simply change the type in the options to the database type you are using: mysql, mariadb, postgres, cockroachdb, sqlite, mssql, oracle, sap, spanner, cordova, nativescript, react-native, expo, or mongodb. Also make sure to use your own host, port, username, password, and database settings.

We added our Photo entity to the list of entities for this data source. Each entity you are using in your connection must be listed there.

Setting synchronize makes sure your entities will be synced with the database, every time you run the application.

Running the application

Now if you run your index.ts, a connection with the database will be initialized and a database table for your photos will be created.

+-------------+--------------+----------------------------+
|                         photo                           |
+-------------+--------------+----------------------------+
| id          | int(11)      | PRIMARY KEY AUTO_INCREMENT |
| name        | varchar(100) |                            |
| description | text         |                            |
| filename    | varchar(255) |                            |
| views       | int(11)      |                            |
| isPublished | boolean      |                            |
+-------------+--------------+----------------------------+

Creating and inserting a photo into the database

Now let's create a new photo to save it in the database:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const photo = new Photo()
photo.name = "Me and Bears"
photo.description = "I am near polar bears"
photo.filename = "photo-with-bears.jpg"
photo.views = 1
photo.isPublished = true

await AppDataSource.manager.save(photo)
console.log("Photo has been saved. Photo id is", photo.id)

Once your entity is saved it will get a newly generated id. save method returns an instance of the same object you pass to it. It's not a new copy of the object, it modifies its "id" and returns it.

Using Entity Manager

We just created a new photo and saved it in the database. We used EntityManager to save it. Using entity manager you can manipulate any entity in your app. For example, let's load our saved entity:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const savedPhotos = await AppDataSource.manager.find(Photo)
console.log("All photos from the db: ", savedPhotos)

savedPhotos will be an array of Photo objects with the data loaded from the database.

Learn more about EntityManager here.

Using Repositories

Now let's refactor our code and use Repository instead of EntityManager. Each entity has its own repository which handles all operations with its entity. When you deal with entities a lot, Repositories are more convenient to use than EntityManagers:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const photo = new Photo()
photo.name = "Me and Bears"
photo.description = "I am near polar bears"
photo.filename = "photo-with-bears.jpg"
photo.views = 1
photo.isPublished = true

const photoRepository = AppDataSource.getRepository(Photo)

await photoRepository.save(photo)
console.log("Photo has been saved")

const savedPhotos = await photoRepository.find()
console.log("All photos from the db: ", savedPhotos)

Learn more about Repository here.

Loading from the database

Let's try more load operations using the Repository:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const photoRepository = AppDataSource.getRepository(Photo)
const allPhotos = await photoRepository.find()
console.log("All photos from the db: ", allPhotos)

const firstPhoto = await photoRepository.findOneBy({
    id: 1,
})
console.log("First photo from the db: ", firstPhoto)

const meAndBearsPhoto = await photoRepository.findOneBy({
    name: "Me and Bears",
})
console.log("Me and Bears photo from the db: ", meAndBearsPhoto)

const allViewedPhotos = await photoRepository.findBy({ views: 1 })
console.log("All viewed photos: ", allViewedPhotos)

const allPublishedPhotos = await photoRepository.findBy({ isPublished: true })
console.log("All published photos: ", allPublishedPhotos)

const [photos, photosCount] = await photoRepository.findAndCount()
console.log("All photos: ", photos)
console.log("Photos count: ", photosCount)

Updating in the database

Now let's load a single photo from the database, update it and save it:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const photoRepository = AppDataSource.getRepository(Photo)
const photoToUpdate = await photoRepository.findOneBy({
    id: 1,
})
photoToUpdate.name = "Me, my friends and polar bears"
await photoRepository.save(photoToUpdate)

Now photo with id = 1 will be updated in the database.

Removing from the database

Now let's remove our photo from the database:

import { Photo } from "./entity/Photo"
import { AppDataSource } from "./index"

const photoRepository = AppDataSource.getRepository(Photo)
const photoToRemove = await photoRepository.findOneBy({
    id: 1,
})
await photoRepository.remove(photoToRemove)

Now photo with id = 1 will be removed from the database.

Creating a one-to-one relation

Let's create a one-to-one relationship with another class. Let's create a new class in PhotoMetadata.ts. This PhotoMetadata class is supposed to contain our photo's additional meta-information:

import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    OneToOne,
    JoinColumn,
} from "typeorm"
import { Photo } from "./Photo"

@Entity()
export class PhotoMetadata {
    @PrimaryGeneratedColumn()
    id: number

    @Column("int")
    height: number

    @Column("int")
    width: number

    @Column()
    orientation: string

    @Column()
    compressed: boolean

    @Column()
    comment: string

    @OneToOne(() => Photo)
    @JoinColumn()
    photo: Photo
}

Here, we are using a new decorator called @OneToOne. It allows us to create a one-to-one relationship between two entities. type => Photo is a function that returns the class of the entity with which we want to make our relationship. We are forced to use a function that returns a class, instead of using the class directly, because of the language specifics. We can also write it as () => Photo, but we use type => Photo as a convention to increase code readability. The type variable itself does not contain anything.

We also add a @JoinColumn decorator, which indicates that this side of the relationship will own the relationship. Relations can be unidirectional or bidirectional. Only one side of relational can be owning. Using @JoinColumn decorator is required on the owner side of the relationship.

If you run the app, you'll see a newly generated table, and it will contain a column with a foreign key for the photo relation:

+-------------+--------------+----------------------------+
|                     photo_metadata                      |
+-------------+--------------+----------------------------+
| id          | int(11)      | PRIMARY KEY AUTO_INCREMENT |
| height      | int(11)      |                            |
| width       | int(11)      |                            |
| comment     | varchar(255) |                            |
| compressed  | boolean      |                            |
| orientation | varchar(255) |                            |
| photoId     | int(11)      | FOREIGN KEY                |
+-------------+--------------+----------------------------+

Save a one-to-one relation

Now let's save a photo, and its metadata and attach them to each other.

import { Photo } from "./entity/Photo"
import { PhotoMetadata } from "./entity/PhotoMetadata"

// create a photo
const photo = new Photo()
photo.name = "Me and Bears"
photo.description = "I am near polar bears"
photo.filename = "photo-with-bears.jpg"
photo.views = 1
photo.isPublished = true

// create a photo metadata
const metadata = new PhotoMetadata()
metadata.height = 640
metadata.width = 480
metadata.compressed = true
metadata.comment = "cybershoot"
metadata.orientation = "portrait"
metadata.photo = photo // this way we connect them

// get entity repositories
const photoRepository = AppDataSource.getRepository(Photo)
const metadataRepository = AppDataSource.getRepository(PhotoMetadata)

// first we should save a photo
await photoRepository.save(photo)

// photo is saved. Now we need to save a photo metadata
await metadataRepository.save(metadata)

// done
console.log(
    "Metadata is saved, and the relation between metadata and photo is created in the database too",
)

Inverse side of the relationship

Relations can be unidirectional or bidirectional. Currently, our relation between PhotoMetadata and Photo is unidirectional. The owner of the relation is PhotoMetadata, and Photo doesn't know anything about PhotoMetadata. This makes it complicated to access PhotoMetadata from the Photo side. To fix this issue we should add an inverse relation, and make relations between PhotoMetadata and Photo bidirectional. Let's modify our entities:

import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    OneToOne,
    JoinColumn,
} from "typeorm"
import { Photo } from "./Photo"

@Entity()
export class PhotoMetadata {
    /* ... other columns */

    @OneToOne(() => Photo, (photo) => photo.metadata)
    @JoinColumn()
    photo: Photo
}
import { Entity, Column, PrimaryGeneratedColumn, OneToOne } from "typeorm"
import { PhotoMetadata } from "./PhotoMetadata"

@Entity()
export class Photo {
    /* ... other columns */

    @OneToOne(() => PhotoMetadata, (photoMetadata) => photoMetadata.photo)
    metadata: PhotoMetadata
}

photo => photo.metadata is a function that returns the name of the inverse side of the relation. Here we show that the metadata property of the Photo class is where we store PhotoMetadata in the Photo class. Instead of passing a function that returns a property of the photo, you could alternatively simply pass a string to @OneToOne decorator, like "metadata". But we used this function-typed approach to make our refactoring easier.

Note that we should use the @JoinColumn decorator only on one side of a relation. Whichever side you put this decorator on will be the owning side of the relationship. The owning side of a relationship contains a column with a foreign key in the database.

Relations in ESM projects

If you use ESM in your TypeScript project, you should use the Relation wrapper type in relation properties to avoid circular dependency issues. Let's modify our entities:

import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    OneToOne,
    JoinColumn,
    Relation,
} from "typeorm"
import { Photo } from "./Photo"

@Entity()
export class PhotoMetadata {
    /* ... other columns */

    @OneToOne(() => Photo, (photo) => photo.metadata)
    @JoinColumn()
    photo: Relation<Photo>
}
import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    OneToOne,
    Relation,
} from "typeorm"
import { PhotoMetadata } from "./PhotoMetadata"

@Entity()
export class Photo {
    /* ... other columns */

    @OneToOne(() => PhotoMetadata, (photoMetadata) => photoMetadata.photo)
    metadata: Relation<PhotoMetadata>
}

Loading objects with their relations

Now let's load our photo and its photo metadata in a single query. There are two ways to do it - using find* methods or using QueryBuilder functionality. Let's use find* method first. find* methods allow you to specify an object with the FindOneOptions / FindManyOptions interface.

import { Photo } from "./entity/Photo"
import { PhotoMetadata } from "./entity/PhotoMetadata"
import { AppDataSource } from "./index"

const photoRepository = AppDataSource.getRepository(Photo)
const photos = await photoRepository.find({
    relations: {
        metadata: true,
    },
})

Here, photos will contain an array of photos from the database, and each photo will contain its photo metadata. Learn more about Find Options in this documentation.

Using find options is good and dead simple, but if you need a more complex query, you should use QueryBuilder instead. QueryBuilder allows more complex queries to be used in an elegant way:

import { Photo } from "./entity/Photo"
import { PhotoMetadata } from "./entity/PhotoMetadata"
import { AppDataSource } from "./index"

const photos = await AppDataSource.getRepository(Photo)
    .createQueryBuilder("photo")
    .innerJoinAndSelect("photo.metadata", "metadata")
    .getMany()

QueryBuilder allows the creation and execution of SQL queries of almost any complexity. When you work with QueryBuilder, think like you are creating an SQL query. In this example, "photo" and "metadata" are aliases applied to selected photos. You use aliases to access columns and properties of the selected data.

Using cascades to automatically save related objects

We can set up cascade options in our relations, in the cases when we want our related object to be saved whenever the other object is saved. Let's change our photo's @OneToOne decorator a bit:

export class Photo {
    // ... other columns

    @OneToOne(() => PhotoMetadata, (metadata) => metadata.photo, {
        cascade: true,
    })
    metadata: PhotoMetadata
}

Using cascade allows us not to separately save photos and separately save metadata objects now. Now we can simply save a photo object, and the metadata object will be saved automatically because of cascade options.

import { AppDataSource } from "./index"

// create photo object
const photo = new Photo()
photo.name = "Me and Bears"
photo.description = "I am near polar bears"
photo.filename = "photo-with-bears.jpg"
photo.isPublished = true

// create photo metadata object
const metadata = new PhotoMetadata()
metadata.height = 640
metadata.width = 480
metadata.compressed = true
metadata.comment = "cybershoot"
metadata.orientation = "portrait"

photo.metadata = metadata // this way we connect them

// get repository
const photoRepository = AppDataSource.getRepository(Photo)

// saving a photo also save the metadata
await photoRepository.save(photo)

console.log("Photo is saved, photo metadata is saved too.")

Notice that we now set the photo's metadata property, instead of the metadata's photo property as before. The cascade feature only works if you connect the photo to its metadata from the photo's side. If you set the metadata side, the metadata would not be saved automatically.

Creating a many-to-one / one-to-many relation

Let's create a many-to-one/one-to-many relation. Let's say a photo has one author, and each author can have many photos. First, let's create an Author class:

import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    OneToMany,
    JoinColumn,
} from "typeorm"
import { Photo } from "./Photo"

@Entity()
export class Author {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    name: string

    @OneToMany(() => Photo, (photo) => photo.author) // note: we will create author property in the Photo class below
    photos: Photo[]
}

Author contains an inverse side of a relation. OneToMany is always an inverse side of the relation, and it can't exist without ManyToOne on the other side of the relation.

Now let's add the owner side of the relation into the Photo entity:

import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from "typeorm"
import { PhotoMetadata } from "./PhotoMetadata"
import { Author } from "./Author"

@Entity()
export class Photo {
    /* ... other columns */

    @ManyToOne(() => Author, (author) => author.photos)
    author: Author
}

In many-to-one / one-to-many relations, the owner side is always many-to-one. It means that the class that uses @ManyToOne will store the id of the related object.

After you run the application, the ORM will create the author table:

+-------------+--------------+----------------------------+
|                          author                         |
+-------------+--------------+----------------------------+
| id          | int(11)      | PRIMARY KEY AUTO_INCREMENT |
| name        | varchar(255) |                            |
+-------------+--------------+----------------------------+

It will also modify the photo table, adding a new author column and creating a foreign key for it:

+-------------+--------------+----------------------------+
|                         photo                           |
+-------------+--------------+----------------------------+
| id          | int(11)      | PRIMARY KEY AUTO_INCREMENT |
| name        | varchar(255) |                            |
| description | varchar(255) |                            |
| filename    | varchar(255) |                            |
| isPublished | boolean      |                            |
| authorId    | int(11)      | FOREIGN KEY                |
+-------------+--------------+----------------------------+

Creating a many-to-many relation

Let's create a many-to-many relation. Let's say a photo can be in many albums, and each album can contain many photos. Let's create an Album class:

import {
    Entity,
    PrimaryGeneratedColumn,
    Column,
    ManyToMany,
    JoinTable,
} from "typeorm"

@Entity()
export class Album {
    @PrimaryGeneratedColumn()
    id: number

    @Column()
    name: string

    @ManyToMany(() => Photo, (photo) => photo.albums)
    @JoinTable()
    photos: Photo[]
}

@JoinTable is required to specify that this is the owner side of the relationship.

Now let's add the inverse side of our relation to the Photo class:

export class Photo {
    // ... other columns

    @ManyToMany(() => Album, (album) => album.photos)
    albums: Album[]
}

After you run the application, the ORM will create a album_photos_photo_albums junction table:

+-------------+--------------+----------------------------+
|                album_photos_photo_albums                |
+-------------+--------------+----------------------------+
| album_id    | int(11)      | PRIMARY KEY FOREIGN KEY    |
| photo_id    | int(11)      | PRIMARY KEY FOREIGN KEY    |
+-------------+--------------+----------------------------+

Don't forget to register the Album class with your connection in the ORM:

const options: DataSourceOptions = {
    // ... other options
    entities: [Photo, PhotoMetadata, Author, Album],
}

Now let's insert albums and photos into our database:

import { AppDataSource } from "./index"

// create a few albums
const album1 = new Album()
album1.name = "Bears"
await AppDataSource.manager.save(album1)

const album2 = new Album()
album2.name = "Me"
await AppDataSource.manager.save(album2)

// create a few photos
const photo = new Photo()
photo.name = "Me and Bears"
photo.description = "I am near polar bears"
photo.filename = "photo-with-bears.jpg"
photo.views = 1
photo.isPublished = true
photo.albums = [album1, album2]
await AppDataSource.manager.save(photo)

// now our photo is saved and albums are attached to it
// now lets load them:
const loadedPhoto = await AppDataSource.getRepository(Photo).findOne({
    where: {
        id: 1,
    },
    relations: {
        albums: true,
    },
})

loadedPhoto will be equal to:

{
    id: 1,
    name: "Me and Bears",
    description: "I am near polar bears",
    filename: "photo-with-bears.jpg",
    albums: [{
        id: 1,
        name: "Bears"
    }, {
        id: 2,
        name: "Me"
    }]
}

Using QueryBuilder

You can use QueryBuilder to build SQL queries of almost any complexity. For example, you can do this:

const photos = await AppDataSource.getRepository(Photo)
    .createQueryBuilder("photo") // first argument is an alias. Alias is what you are selecting - photos. You must specify it.
    .innerJoinAndSelect("photo.metadata", "metadata")
    .leftJoinAndSelect("photo.albums", "album")
    .where("photo.isPublished = true")
    .andWhere("(photo.name = :photoName OR photo.name = :bearName)")
    .orderBy("photo.id", "DESC")
    .skip(5)
    .take(10)
    .setParameters({ photoName: "My", bearName: "Mishka" })
    .getMany()

This query selects all published photos with "My" or "Mishka" names. It will select results from position 5 (pagination offset) and will select only 10 results (pagination limit). The selection result will be ordered by id in descending order. The photo albums will be left joined and their metadata will be inner joined.

You'll use the query builder in your application a lot. Learn more about QueryBuilder here.

Samples

Take a look at the samples in sample for examples of usage.

There are a few repositories that you can clone and start with:

Extensions

There are several extensions that simplify working with TypeORM and integrating it with other modules:

Contributing

Learn about contribution here and how to set up your development environment here.

This project exists thanks to all the people who contribute:

Sponsors

Open source is hard and time-consuming. If you want to invest in TypeORM's future you can become a sponsor and allow our core team to spend more time on TypeORM's improvements and new features. Become a sponsor

Gold Sponsors

Become a gold sponsor and get premium technical support from our core contributors. Become a gold sponsor

ionic-example's People

Contributors

daniel-lang avatar dependabot[bot] avatar imnotjames avatar nextlevelshit avatar pleerock avatar pmargreff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic-example's Issues

TypeORM slow down startup time of ionic app

I can reproduce it on a new project, If I add TypeORM according to the Readme file to my project, my app start normally in about 4sec (prod mode).

But if somewhere in my app I use an entity created for typeORM (without creating database connection and without inserting it, just a new), like :
let user = new TestUser();

I noticed that my app take 2 seconds more to start even if my new is never called nowhere... Is it possible to do this job in background and not at startup, because I don't really need TypeORM at startup.

Do you know why does it slow down the app startup ?
I can give you a step to reproduce if you tell me it's abnormal.

Primary/Foreign keys are not set on device using ActiveRecord

Hey,

I have build and tested an app in chrome browser, where it runs smoothly. The problem is that keys won't be set on real devices. Tested using iOS 11.2.6 and Android 7.1.1.

Sample Code:
City Entity

import {Entity, PrimaryGeneratedColumn, Column, OneToMany, BaseEntity} from 'typeorm';
import {Tour} from "./tour";

@Entity("City")
export class City extends BaseEntity {

    @PrimaryGeneratedColumn()
    public id: number;
    @Column()
    public name: string;

    @OneToMany(type => Tour, tour => tour.city)
    public tours: Tour[];

}

Tour Entity

import {Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany, BaseEntity} from 'typeorm';
import {City} from "./city";

@Entity("Tour")
export class Tour extends BaseEntity {

    @PrimaryGeneratedColumn()
    public id: number;
    @Column()
    public name: string;

    @ManyToOne(type => City, city => city.tours)
    public city: City;

}

Tables are correctly generated:

console.log: creating a new table: City
console.info: query: CREATE TABLE "City" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(10000) NOT NULL)
console.log: creating a new table: Tour
console.info: query: CREATE TABLE "Tour" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(10000) NOT NULL, "cityId" integer)
console.log: creating a foreign keys: FK_6975824c36f19794cee06158b73 on table "Tour"
console.info: query: CREATE TABLE "temporary_Tour" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(10000) NOT NULL, "cityId" integer, CONSTRAINT "FK_6975824c36f19794cee06158b73" FOREIGN KEY ("cityId") REFERENCES "City" ("id"))
console.info: query: INSERT INTO "temporary_Tour"("id", "name", "cityId") SELECT "id", "name", "cityId" FROM "Tour"
console.info: query: DROP TABLE "Tour"
console.info: query: ALTER TABLE "temporary_Tour" RENAME TO "Tour"

Connecting and inserting into the database:

if (platform.is('cordova')) {
            // Running on device or emulator
            await createConnection({
                type: 'cordova',
                database: 'db',
                location: 'default',
                logging: ['error', 'query', 'schema'],
                synchronize: true,
                entities: [
                    City,
                    Tour
                ]
            });
        }
        else {
            // Running app in browser
            await createConnection({
                type: 'sqljs',
                autoSave: true,
                location: 'browser',
                logging: ['error', 'query', 'schema'],
                synchronize: true,
                entities: [
                    City,
                    Tour
                ]
            });
        }

        let city = new City();
        city.name = "City";
        await city.save();
        console.log("city: " + JSON.stringify(city));

        let tour = new Tour();
        tour.name = "Tour";
        tour.city = city;
        await tour.save();
        console.log("tour: " + JSON.stringify(tour));

In the insert statements notice the NULL at the point where the foreign key should be, also the city should have an id at this point:

console.info: query: BEGIN TRANSACTION
console.info: query: INSERT INTO "City"("name") VALUES (?) -- PARAMETERS: ["City"]
console.info: query: COMMIT
console.log: city: {"name":"City"}
console.info: query: BEGIN TRANSACTION
console.info: query: INSERT INTO "Tour"("name", "cityId") VALUES (?, NULL) -- PARAMETERS: ["Tour"]
console.info: query: COMMIT
console.log: tour: {"name":"Tour", "city":{"name":"City"}}

Loading the relation obviously fails:

cities = await City.find({ relations: ["tours"] }) as City[];
console.log("cities loaded:" + JSON.stringify(this.cities));

or alternatively

 city.tours = await getConnection()
            .createQueryBuilder()
            .relation("City", "tours")
            .of(city)
            .loadMany();

The output is:
console.log: cities loaded:[{"id":1,"name":"City","tours":[]}]
Interestingly the city has an id here.

Manually adding the cityId as Column to the tour entity and setting it does not work either:

        let tour = new Tour();
        tour.name = "Tour";
        tour.city = city;
        tour.cityId = city.id;
        console.log("tour: " + JSON.stringify(tour));
        await tour.save();

Device output:

console.log: tour: {"name":"Tour","city":{"name":"City"}}
console.info: query: BEGIN TRANSACTION
console.info: query: INSERT INTO "Tour"("name", "cityId") VALUES (?, NULL) -- PARAMETERS: ["Tour"]
console.error: query failed: INSERT INTO "Tour"("name", "cityId") VALUES (?, NULL) -- PARAMETERS: ["Tour"]
console.error: error: [object Object]
console.info: query: ROLLBACK

Whereas the browser output looks as follows. On device the SELECT last_insert_rowid() is not called:

query:  BEGIN TRANSACTION
query:  INSERT INTO "City"("name") VALUES (?) -- PARAMETERS: ["City"]
query:  SELECT last_insert_rowid()
query:  COMMIT
city: {"name":"City","id":1}
query:  BEGIN TRANSACTION
query:  INSERT INTO "Tour"("name", "cityId") VALUES (?, ?) -- PARAMETERS: ["Tour",1]
query:  SELECT last_insert_rowid()
query:  COMMIT
tour: {"name":"Tour","city":{"name":"City","id":1},"cityId":1,"id":1}

Seems to be a problem with creating a primary key, as everything else is working as expected when I set it manually:

        let city = new City();
        console.log("city: " + JSON.stringify(city));
        city.id = 1;
        console.log("city: " + JSON.stringify(city));
        city.name = "City";
        await city.save();
        console.log("city: " + JSON.stringify(city));

Device Output:

console.log: city: {}
console.log: city: {"id":1}
console.info: query: SELECT "City"."id" AS "City_id", "City"."name" AS "City_name" FROM "City" "City" WHERE ("City"."id" = ?) -- PARAMETERS: [1]
console.info: query: BEGIN TRANSACTION
console.info: query: INSERT INTO "City"("name") VALUES (?, ?) -- PARAMETERS: ["City"]
console.info: query: COMMIT
console.log: city: {"id":1,"name":"City"}

Build time

Hi, I based my project on your template and i fixed most of issues that i found. But noticed that the time for building is too much.
I think is related to the webpack, im not expert on web pack files... so do you have any tip to deal with this issue?

Error about relations in --prod --release apk

Hello everybody,

Relation columns are not created when I use the apk generated by ionic cordova build android --prod --release
In debug mode I have no issues.

Model:

import { Estado, Endereco } from './models';
import {Entity, PrimaryColumn, Column, ManyToOne, OneToMany} from 'typeorm';

@Entity(Cidade.nome)
export class Cidade {
  static nome: string = "Cidade";

  @PrimaryColumn()
  id: number;
  @Column()
  nome: string;
  @ManyToOne(type => Estado)
  estado: Estado;
  @Column({nullable: true})
  imgUrl: string;
  @OneToMany(type => Endereco, endereco => endereco.cidade)
  enderecos: Endereco[];
}

DDL in prod
CREATE TABLE Cidade ( id INTEGER NOT NULL, nome VARCHAR NOT NULL, imgUrl VARCHAR, PRIMARY KEY ( id ) );
DDL in debug
CREATE TABLE Cidade ( id INTEGER NOT NULL, nome VARCHAR NOT NULL, imgUrl VARCHAR, estadoId INTEGER, FOREIGN KEY ( estadoId ) REFERENCES Estado (id), PRIMARY KEY ( id ) );

node-sqlcipher with TypeORM

I'm using node-sqlcipher, which is a modified fork of node-sqlite3 that uses SQLCipher. It works fine without TypeORM, but I couldn't make it work with TypeORM. I have added the 'key' option to the ConnectionOptions: key: 'sqlcipher-key'

I get the following exception when I add the key option:
ERROR Error: Uncaught (in promise): Error: SQLITE_ERROR: near "-": syntax error Error: SQLITE_ERROR: near "-": syntax error at resolvePromise (zone.js:814) at zone.js:724 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:14060) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:387) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:138) at zone.js:872 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:14051)

Adding the key in the 'extra' option extra: { key: 'sqlcipher-key' } doesn't throw an exception, but the database doesn't get encrypted.

TypeORM Version: 0.2.11

➕Cordova-SQLite-storage dependency-- Major release in July 2018 with breaking changes

Verify/update compatibility with cordova-sqlite-storage ➕dependency.

storesafe/cordova-sqlite-storage@8c4609b
Excerpt from https://github.com/litehelpers/Cordova-sqlite-storage July 2018:

NEW MAJOR RELEASE in July 2018 with BREAKING CHANGES
New release in July 2018 will include the following major enhancements (storesafe/cordova-sqlite-storage#773): ...

WARNING: Multiple SQLite problem on all platforms
with possible corruption risk in case of sqlite access from multiple plugins (see below)

Question about the DatabaseProvider removal

Hi,
i see that the Database provider was removed to match typeorm's code style, but what's now the preferred way to put the connection handling for the app in one place? If the connection is estabilished in the controller, the code will be repeated in every controller vs one time using a singleton class (e.g. a provider).

Fails to run

Running ionic serve results in the following error:

Typescript Error
Initializers are not allowed in ambient contexts.

error in Connection.d.ts line 40

steps to reproduce - simply clone, npm install and run ionic serve

In Ionic, what's the meaning of "synchronize" at connection options?

According to the ORM document guide, the "synchronize" at connection options should not be true in production like below:

http://typeorm.io/#/connection-options
synchronize - Indicates if database schema should be auto created on every application launch. Be careful with this option and don't use this in production - otherwise you can loose production data. This option is useful during debug and development. As an alternative to it, you can use CLI and run schema:sync command. Note that for MongoDB database it does not create schema, because MongoDB is schemaless. Instead, it syncs just by creating indices.

But in the case of mobile App, we can't create database schema in advance by CLI.

Migrations in Ionic 3 app

Migrations work just single time when app launches after updating.
Suppose I want to add indexing on username, I do migration with create index query.
So, after update when app launches, migration run and works fine, but when app restarts, migration doesn't persist. Means there would be no indexing on username table. and I can see in the console for the app when it launches second time after update that "executing query drop index ...".
I'm creating migrations through typeorm cli. and the connection code is:

type: 'cordova',
database: 'test',
location: 'default',
logging: ['error', 'query', 'schema'],
synchronize: true,
entities: [
           ],
migrations:[
        test1513333532879
],
migrationsRun: true
}).catch(err => console.log("error: ", err));

I can see in console for the app that when app relaunches second time after an update,
"executing query drop index ..." command appears among with these lines :

executing query: PRAGMA table_info("users")
executing query: PRAGMA index_list("users")

Ionic 4/Angular 6 compatibility?

While considering TypeORM for a new production project, I was able to get the example app running no problem. Works as expected, looks great.

Now trying to configure it w/ my project environment and I've thrown a lot of time away. I'm using the new Ionic 4 beta 12 along with Angular 6. I'm getting the same issues referenced here re: @types/node and some settings in tsconfig.json files:

typeorm/typeorm#900

But the suggested fixes don't work (see my latest comment on that thread). Any idea if TypeORM can or will support Ionic 4 + Angular 6? I can post more info if requested - not sure if anyone's monitoring issues here. Cheers & thanks.

Cannot read property 'openDatabase' of undefined

It works fine at web browser, but when im trying to deploy it at android, it says

Uncaught (in promise): TypeError: Cannot read property 'openDatabase' of undefined TypeError: Cannot read property 'openDatabase' of undefined at http://192.168.43.239:8100/build/vendor.js:194991:26 at new t (http://192.168.43.239:8100/build/polyfills.js:3:21506) at CordovaDriver.createDatabaseConnection (http://192.168.43.239:8100/build/vendor.js:194986:16) at CordovaDriver.<anonymous> (http://192.168.43.239:8100/build/vendor.js:47853:51) at step (http://192.168.43.239:8100/build/vendor.js:47727:23) at Object.next (http://192.168.43.239:8100/build/vendor.js:47708:53) at http://192.168.43.239:8100/build/vendor.js:47702:71 at new t (http://192.168.43.239:8100/build/polyfills.js:3:21506) at __awaiter (http://192.168.43.239:8100/build/vendor.js:47698:12) at CordovaDriver.AbstractSqliteDriver.connect (http://192.168.43.239:8100/build/vendor.js:47847:16)

here is my ionic info

cli packages: (/usr/lib/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 6.2.3 browser 4.1.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v6.10.0
    npm               : 3.10.10 
    OS                : Linux 3.13

Migrations generation

Hello!

Is there any ability to auto-generate migrations for app entities?

For example, i have src/entities/category.ts:

import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";

@Entity('category')
export class Category {

    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    name: string;
}

Then i've added this code to src/app/app.component.ts:

if(platform.is('cordova')) {
            // Running on device or emulator
            await createConnection({
                type: 'cordova',
                database: 'test',
                location: 'default',
                logging: ['error', 'query', 'schema'],
                synchronize: false,
                entities: [
                    Category
                ]
            });
        } else {
            // Running app in browser
            await createConnection({
                type: 'sqljs',
                autoSave: true,
                location: 'browser',
                logging: ['error', 'query', 'schema'],
                synchronize: false,
                entities: [
                    Category
                ]
            });
}

What should i do to generate migration for Category entity creation? According docs in this repo i understood that i should write migration code myself and then add this to migrations property of createConnection(). May be there is any hint here?

Regards, Nikolay

When Ionic build with AOT, the relation between entities will not be recognized.

When Ionic build with option like --prod or --aot, it'll pass AOT process. But when App is started, it emits not defined reference error at 31 lines like below.

[Versions]
Angular: 5.2.11
ionic-angular: 3.9.2
ionic/app-script: 3.1.9
typeorm: 0.2.7

[Entity: categories.ts]
`
@entity("Categories")
@Index("fk_Categories_Categories1_idx",["Categories_id",])
export class Categories {

@PrimaryGeneratedColumn({
    name:"id"
    })
id:number;
    

@Column("varchar",{ 
    nullable:false,
    length:45,
    name:"name"
    })
name:string;
    

@Column("boolean",{ 
    nullable:true,
    name:"isInactive"
    })
isInactive:boolean;

31: @manytoone(type=>Categories, Categories_id=>Categories_id.subCategories)
@joincolumn({ name:'Categories_id'})
Categories_id:Categories;

@OneToMany(type=>Categories, categories=>categories.Categories_id)
subCategories:Categories[];



@OneToMany(type=>Products, products=>products.Categories_id)
products:Products[];

}
`

[Error]
ore.js:1449 ERROR Error: Uncaught (in promise): ReferenceError: Categories_1 is not defined
ReferenceError: Categories_1 is not defined
at Object.ɵ0 [as type] (categories.ts:31)
at new RelationMetadata (RelationMetadata.js:138)
at EntityMetadataBuilder.js:338
at Array.map ()
at EntityMetadataBuilder.computeEntityMetadataStep1 (EntityMetadataBuilder.js:334)
at EntityMetadataBuilder.js:68
at Array.forEach ()
at EntityMetadataBuilder.build (EntityMetadataBuilder.js:68)
at ConnectionMetadataBuilder.buildEntityMetadatas (ConnectionMetadataBuilder.js:56)
at Connection.buildMetadatas (Connection.js:509)
at Object.ɵ0 [as type] (categories.ts:31)
at new RelationMetadata (RelationMetadata.js:138)
at EntityMetadataBuilder.js:338
at Array.map ()
at EntityMetadataBuilder.computeEntityMetadataStep1 (EntityMetadataBuilder.js:334)
at EntityMetadataBuilder.js:68
at Array.forEach ()
at EntityMetadataBuilder.build (EntityMetadataBuilder.js:68)
at ConnectionMetadataBuilder.buildEntityMetadatas (ConnectionMetadataBuilder.js:56)
at Connection.buildMetadatas (Connection.js:509)
at c (polyfills.js:3)
at polyfills.js:3
at polyfills.js:3
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.js:4760)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)

Add description on how to disable mangling

As already mentioned here #27, please add a description on how to disable mangling for ionic 3 due to the following issue: typeorm/typeorm#2164
I lost a lot of time because of this issue.

Description could be something like this:
Disable mangling as described under the following link:
https://ionicframework.com/docs/v3/developer-resources/app-scripts/

  1. Create a new file under ./config/uglifyjs.config
  2. Copy paste the following content
module.exports = {
  /**
   * mangle: uglify 2's mangle option
   */
  mangle: false,

  /**
   * compress: uglify 2's compress option
   */
  compress: {
    toplevel: true,
    pure_getters: true
  }
};
  1. Add the path to the file under package.json like this:
....
 "config": {
    "ionic_uglifyjs": "./config/uglifyjs.config.js"
  },
...

[Question] Is it possible to bind Subscribers to Angular's DI system?

I tried to bind Subscriber to Angular DI like code below. But it look like not working, because this.auditsProv is always Undefined. If it's not impossible, should I have to use another DI for Subscribers like TypeDI(https://github.com/typeorm/typeorm-typedi-extensions)?

[post-subs.ts]
import { Injectable } from '@angular/core';
import { EventSubscriber, EntitySubscriberInterface, InsertEvent } from "typeorm";
import { AuditsProvider } from '../providers/audits/audits';

@Injectable()
@EventSubscriber()
export class PostSubscriber implements EntitySubscriberInterface {

constructor(private auditsProv: AuditsProvider) {
console.log(this.auditsProv);
}

/**

  • Called before entity insertion.
    */
    beforeInsert(event: InsertEvent) {
    console.log(BEFORE ENTITY INSERTED: , event.entity);
    this.auditsProv.save();
    }

}

[app.module.ts]
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
AuditsProvider,
PostSubscriber
]
})
export class AppModule {}

Anyone found a way to handle Dates in Ionic production build?

Please has anyone found a way around the date datatype problem with ionic production builds. I am building an app which is date-centric and this limitation is a downer cos typeorm has everything I need but this. Please help! I need pointers or suggestions

Outdated lifecycle function for ionic 5

I was trying to use this example repo for my project but ran into the issue using the function:

ionViewDidLoad() {
    this.runDemo();
}

found in ionic-example/src/pages/home/home.ts. Seems like that function is deprecated in Ionic 5 so instead I did:

ngOnInit() {
    this.loadEvents();
}

Is this the recommended method or should I be using ionViewWillEnter()?
Is there any likelihood of this example repo being updated for Ionic 5?

When Ionic build with minifyjs option, the CircularRelationError will be emitted.

When I try to build with --minifyjs, it also emits circular relations error like this. The minifyjs option includes the mangling by uglifyjs. I think the TypeORM is not safe about this mangling process. But the mangling process in Ionic is default. Ionic itself includes this mangling process in production build process with --prod option.

ERROR Error: Uncaught (in promise): CircularRelationsError: Circular relations detected: e -> t -> e. To resolve this issue you need to set nullable: false somewhere in this dependency structure.
CircularRelationsError: Circular relations detected: e -> t -> e. To resolve this issue you need to set nullable: false somewhere in this dependency structure.
at new t (vendor.js:1)
at e.validateDependencies (vendor.js:1)
at e.validateMany (vendor.js:1)
at e.buildMetadatas (vendor.js:1)
at e. (vendor.js:1)
at vendor.js:1
at Object.next (vendor.js:1)
at s (vendor.js:1)
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:1)
at new t (vendor.js:1)
at e.validateDependencies (vendor.js:1)
at e.validateMany (vendor.js:1)
at e.buildMetadatas (vendor.js:1)
at e. (vendor.js:1)
at vendor.js:1
at Object.next (vendor.js:1)
at s (vendor.js:1)
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:1)
at c (polyfills.js:3)
at polyfills.js:3
at polyfills.js:3
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:1)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:1)

connection not establishing when using ormconfig.json, webpack error

Connection is not establishing when using ormconfig.js. Giving error that "Module '.' not found" with code:

export default {
    type: 'websql',
    database: 'test0',
    version: "1",
    description: "test database",
    size: 2 * 1024 * 1024,
    logging: true,
    synchronize: true,
    entities: []
}

and when using webpack, it is giving error that :
Failed operation : require("debug")

No production builds with AOT possible (--prod flag)

I'm currently working on a new ionic project and trying out TypeORM. While trying to do my first production build for testing out typeorm/typeorm#2419 I found that its currently not possible to build ionic (angular) projects with AoT compiler (ahead of time) turned on when typeORM is included, including this example project.

When using the term "production build" I mean this command: "ionic cordova build ios --prod --release" (the --prod flag is the problematic one).

There are three problems:

  1. In its current state this example project is using angular 4.x with typescript 2.9 ("^2.7.1") despite that angular 4 only works with TS 2.3 but it was not specified in its package.json so you get no warning when installing it. The dev and prod builds both finish without any error however as the angular compiler doesn't (yet) complain about the wrong TS version., but I can't open the prod version of the app after a prod build. I only get this error:
vendor.js:1 Uncaught Error: Cannot find module "."
    at vendor.js:1
    at vendor.js:1
    at Object.<anonymous> (vendor.js:1)
    at e (vendor.js:1)
    at Object.241 (main.js:1)
    at e (vendor.js:1)
    at window.webpackJsonp (vendor.js:1)
    at main.js:1
  1. As ionic 3.x doesn't support the current angular version of 6.0.7 I next updated to the last angular5 version of 5.2.10. After I did this, every production build failed, because the angular AOT compiler will now fail the build because of the wrong TS version. After downgrading TS to 2.6.2 (the last supported TS version in angular5), I got this error message during production build:
TypeError: Cannot read property 'kind' of undefined
    at nodeCanBeDecorated (/Users/mzrinck/projects/ionic-example/node_modules/typescript/lib/typescript.js:8376:36)
    at nodeIsDecorated (/Users/mzrinck/projects/ionic-example/node_modules/typescript/lib/typescript.js:8396:16)
    at Object.nodeOrChildIsDecorated (/Users/mzrinck/projects/ionic-example/node_modules/typescript/lib/typescript.js:8400:16)
    at isDecoratedClassElement (/Users/mzrinck/projects/ionic-example/node_modules/typescript/lib/typescript.js:53700:23) 

The cause of this is a typescript bug which is only fixed in TS 2.7.x, see angular/angular-cli#8434 The problem seems to be a bug when arrow functions are used in decorators (which typeorm uses frequently) and the angular AoT compiler triggers this.

That means this can't be fixed in a current ionic 3.x project as only ionic 4.x will officially support angular6 and TS >= 2.7.

Oh, and btw, the same happens when doing this in angular4 and TS 2.4.

  1. Even when upgrading to angular and rxjs to 6.0.7 (and including rxjs-compat package and ignoring ionic dependency warning) will not work. Development builds are working at first glance and prod builds work without any error butthe resulting application will not run as I only got this error:
vendor.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'Database' of undefined
TypeError: Cannot read property 'Database' of undefined
    at n.<anonymous> (vendor.js:1)
    at vendor.js:1
    at Object.next (vendor.js:1)
    at vendor.js:1
    at new t (polyfills.js:3)
    at l (vendor.js:1)
    at n.createDatabaseConnectionWithImport (vendor.js:1)
    at n.load (vendor.js:1)
    at n.createDatabaseConnection (vendor.js:1)
    at n.<anonymous> (vendor.js:1)
    at n.<anonymous> (vendor.js:1)

This is a problem with the SqlJs driver (in its createDatabaseConnectionWithImport method). I don't know if its caused by angular6 but I doubt it. I guess this error would be thrown even in the other versions when they would work and it seems to be caused by optimizations maybe? I don't know, I'm not an expert enough.

In the end, there is currently no way to do ANY builds with --prod flag when I include typeORM to my project. As ionic 4.x seems to be released in the coming months, problem 1 and 2 will be fixed as TS 2.7 can be used then, but I'm not so sure about 3.

Migrations Run fail with Ionic Release

I am using TypeORM to write my own migrations, and everything runs perfectly as long as I am running it in development mode. My app.component.ts contains the config like this:

import { Initial1526102914720 } from '../migrations/1526102914720-Initial';
import { AddSampleId1526283035169 } from '../migrations/1526283035169-AddSampleId';

if (platform.is('android')) {
					// Running on device or emulator
					await createConnection({
						type: 'cordova',
						database: 'test',
						location: 'default',
						logging: ['error', 'query', 'schema'],
						synchronize: false,
						entities: [
							Crop,
							User,
							Farm,
							FarmMapping,
							Plan,
							PlanMapping
						],
						migrations: [
                                                        Initial1526102914720,
							AddSampleId1526283035169
						],
						migrationsRun: true
					}).then(connection => {
						this.rootPage = OfflinePage;
					});
				}

When I build the app using --release flag and run, the app fails with:

Uncaught (in promise): Error: a migration name is wrong. Migration class name should have a UNIX timestamp appended. 
Error: a migration name is wrong. Migration class name should have a UNIX timestamp appended.

What I think could be happening is Webpack renames the classes and TypeORM is trying to verify the name of the class contains the Timestamp in order to validate the order of migrations.

TypeORMError: Transactions are not supported by the Cordova driver

Dear good afternoon, I am working with ionic and sqlite, looking for an orm to work better I found this post from you.
I followed all the steps, but I can't get it to work, it generates the following error:
Captura de Pantalla 2021-11-25 a la(s) 14 16 03

Cloning your project works perfect, but when I want to do it in my own projects this happens to me.

Could you help me please?

I leave a new project, where you can reproduce the error, if it helps in something.
https://github.com/ahellrigl/typeorm

If this is not the way for this consultation please tell me.

Thank you.

Greetings.

Ionic run build --prod give Repository not found error

In developement and Prod android version works fine. But when I tried with the browser. I get the error.
I follow the [https://github.com/typeorm/ionic-example]

Any help?

here is my config file.

import { Expense } from './../entities/expense';
import { Medicine } from './../entities/medicine';
import { Client } from './../entities/client';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { createConnection } from 'typeorm'
import { Company } from '../entities/company';
import { Order } from '../entities/order';
import { OrderDetail } from '../entities/orderDetail';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage: string = "LoginPage";

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(async () => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();

      // Depending on the machine the app is running on, configure
      // different database connections
      if(platform.is('cordova')) {
        // Running on device or emulator
        await createConnection({
          type: 'cordova',
          database: 'test',
          location: 'default',
          synchronize: true,
          logging: ['error', 'query', 'schema'],
          entities: [
            Client,Medicine,Company, Order, OrderDetail, Expense
          ]
        });
      } else {
        // Running app in browser
        await createConnection({
          type: 'sqljs',
          autoSave: true,
          location: 'browser',
          synchronize: true,
          logging: ['error', 'query', 'schema'],
          entities: [
            Client, Medicine, Company, Order, OrderDetail, Expense
          ]
        });
      }
    });
  }
}

Test with ionic serve

I could run the sample both on emulator and device, but I cannot do it on browser.
I get a runtime error:

Error: Uncaught (in promise): TypeError: Cannot read property 'openDatabase' of undefined
TypeError: Cannot read property 'openDatabase' of undefined
at http://localhost:8100/build/vendor.js:143551:26
at new t (http://localhost:8100/build/polyfills.js:3:20014)
at CordovaDriver.createDatabaseConnection (http://localhost:8100/build/vendor.js:143550:16)
at CordovaDriver. (http://localhost:8100/build/vendor.js:40604:51)...

Screenshot:
typeormerror

Is it possible to utilize a sqlite encrypted database by TypeORM in Ionic?

I am making a Ionic App with TypeORM, but we need to protect the sqlite database file by being encrypted with SQLCipher library(https://github.com/sqlcipher/sqlcipher). There is already for Cordova plug-in(https://github.com/litehelpers/Cordova-sqlcipher-adapter) for this. But TypeORM looks like not working with this plug-in yet.

Do you think that it's possible to be supported in TypeORM in near future if I request this new feature to TypeORM? Very thanks.

After npm install typeorm@next, many errors shows at node_modules/typeorm/find-options/FindOptions.d.ts

After npm install typeorm@next, many errors shows at node_modules/typeorm/find-options/FindOptions.d.ts like what mentioned at #1926. And the version of installed is [email protected].

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        ';' expected. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp

  L15:  };



        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        ';' expected. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        '(' expected. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  of E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R>

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        ',' expected. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E

  L15:  };

        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {
  L14:  )[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? Find

  L15:  };


        Expression expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:   ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOpt

  L15:  };


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:   : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : Find

  L15:  };


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  [P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOpti

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        '(' expected. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;

  L15:  };


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;

  L15:  };


        Declaration or statement expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 15

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;

  L15:  };


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin

  L22:  }[keyof E];


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin

  L22:  }[keyof E];


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];



        Declaration or statement expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 22

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];



        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 22

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        ';' expected. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe

  L29:  };


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        ';' expected. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe

  L29:  };


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptio
  L29:  };



        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        ',' expected. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  nds (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> 

  L29:  };


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  ionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRe
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Expression expected. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  sRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelat

  L29:  };


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        ',' expected. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;

  L29:  };


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };



        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 29

        Declaration or statement expected. 


  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;

  L29:  };


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 

  L39:  };


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 
  L39:  };



        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        '(' expected. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  f E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptio

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        ',' expected. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  ] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        ',' expected. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  tends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | 

  L39:  };

        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {
  L38:  ptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends ob

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Expression expected. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  onsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends objec

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        '(' expected. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E

  L39:  };


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  ends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boo

  L39:  };


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:   Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean

  L39:  };


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 39

        Declaration or statement expected. 


  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        ')' expected. 


  L43:  export declare type FindOptionsWhere<E> = {

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L45:  } | {


        ';' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L45:  } | {


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  of E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R>
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        ',' expected. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  ]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E
  L45:  } | {


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  )[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? Find
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Expression expected. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:   ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOpe
  L45:  } | {


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:   : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltO
  L45:  } | {

        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  [P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOpera
  L45:  } | {


        '(' expected. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : Fi
  L45:  } | {

        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  ds Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindA
  L45:  } | {


        '(' expected. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        '(' expected. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        Declaration or statement expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 45

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];


        Expression expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 45

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        ']' expected. 


  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];



        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Property assignment expected. 


  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        Property assignment expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];



        ':' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        ',' expected. 


  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        ',' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        '{' expected. 


  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];



        Expression expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        ':' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  of E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R>

  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        ',' expected. 


  L45:  } | {

  L46:  ]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E

  L47:  }[];


        ':' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:   extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] exte

  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        ',' expected. 

  L45:  } | {

  L46:  )[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? Find

  L47:  }[];


        ':' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:  [] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindO
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Expression expected. 


  L45:  } | {

  L46:   ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOpe

  L47:  }[];


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:   : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOpti

  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        ',' expected. 


  L45:  } | {

  L46:  [P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsW

  L47:  }[];


        ':' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:  ds Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]
  L47:  }[];



        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];

  L47:  }[];


        '(' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        '(' expected. 

  L45:  } | {

  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];

  L47:  }[];


        ')' expected. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'infer'. 

  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp

  L15:  };


        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp
  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        'FindOptionsOrder' only refers to a type, but is being used as a value here. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOp

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'R'. 

  L13:  export declare type FindOptionsOrder<E> = {
  L14:  keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder

  L15:  };


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:   E]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> :
  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'P'. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ]?: E[P] extends (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E

  L15:  };


        Cannot find name 'infer'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  (infer R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends objec
  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'R'. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  )[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? Find
  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        'FindOptionsOrder' only refers to a type, but is being used as a value here. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:   R)[] ? FindOptionsOrder<R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? Fi

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'R'. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  <R> : E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : F
  L15:  };



        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:   E[P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOp
  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'P'. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  [P] extends Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOpti

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        Cannot find name 'object'. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ds Promise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderB

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

        'FindOptionsOrder' only refers to a type, but is being used as a value here. 


  L13:  export declare type FindOptionsOrder<E> = {

  L14:  romise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByVal

  L15:  };


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;

  L15:  };


        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;
  L15:  };



        'FindOptionsOrderByValue' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 14

  L13:  export declare type FindOptionsOrder<E> = {

  L14:  ise<infer R> ? FindOptionsOrder<R> : E[P] extends object ? FindOptionsOrder<E[P]> : FindOptionsOrderByValue;

  L15:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'object'. 

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin
  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'K'. 


  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin
  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'E'. 

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin

  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'K'. 


  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefin
  L22:  }[keyof E];



        Cannot find name 'object'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:    [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined
  L22:  }[keyof E];



        Object is possibly 'null'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:  yof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : nev
  L22:  }[keyof E];



        Cannot find name 'K'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {
  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;

  L22:  }[keyof E];


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'K'. 


  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

        Cannot find name 'object'. 


  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];


        Object is possibly 'undefined'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;

  L22:  }[keyof E];


        Cannot find name 'K'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;
  L22:  }[keyof E];



        'never' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 21

  L20:  export declare type FindOptionsRelationKeyName<E> = {

  L21:   E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;

  L22:  }[keyof E];


        Cannot find name 'keyof'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 22

  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;

  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 22

        Cannot find name 'E'. 


  L21:      [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never;

  L22:  }[keyof E];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'infer'. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe

  L29:  };


        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        'FindOptionsRelation' only refers to a type, but is being used as a value here. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infe

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'R'. 

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  of E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOp

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        'boolean' only refers to a type, but is being used as a value here. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:   E]?: E[P] extends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOpti
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'E'. 

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  tends (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'P'. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  nds (infer R)[] ? FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> 

  L29:  };


        Cannot find name 'infer'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:   FindOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindO
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'R'. 

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  ionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRe

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        'FindOptionsRelation' only refers to a type, but is being used as a value here. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  dOptionsRelation<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptio

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'R'. 

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        'boolean' only refers to a type, but is being used as a value here. 

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        'FindOptionsRelation' only refers to a type, but is being used as a value here. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;

  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'E'. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

        Cannot find name 'P'. 


  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;
  L29:  };



        'boolean' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 28

  L27:  export declare type FindOptionsRelationKey<E> = {

  L28:  an : E[P] extends Promise<infer R> ? FindOptionsRelation<R> | boolean : FindOptionsRelation<E[P]> | boolean;

  L29:  };


        Type 'FindOptionsRelationKeyName<E>' does not satisfy the constraint 'keyof E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 33

  L33:  ation<E> = FindOptionsRelationKeyName<E>[] | FindOptionsRelationKey<Pick<E, FindOptionsRelationKeyName<E>>>;



        Cannot find name 'infer'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'R'. 

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        'FindOptionsSelect' only refers to a type, but is being used as a value here. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer 

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'R'. 

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {
  L38:  eyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOp

  L39:  };


        'boolean' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  of E]?: E[P] extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOpti

  L39:  };


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  extends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> 
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'P'. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  tends (infer R)[] ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | 

  L39:  };


        Cannot find name 'infer'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:   ? FindOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] ex
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'R'. 

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  ptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends ob

  L39:  };


        'FindOptionsSelect' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  ndOptionsSelect<R> | boolean : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'R'. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  an : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelec
  L39:  };



        'boolean' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:   : E[P] extends Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<
  L39:  };



        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  ds Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boole
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'P'. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:   Promise<infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean

  L39:  };


        Cannot find name 'object'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  infer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolea
  L39:  };



        'FindOptionsSelect' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'E'. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;
  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        Cannot find name 'P'. 

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };


        'boolean' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 38

        'boolean' only refers to a type, but is being used as a value here. 


  L37:  export declare type FindOptionsSelect<E> = (keyof E)[] | {

  L38:  fer R> ? FindOptionsSelect<R> | boolean : E[P] extends object ? FindOptionsSelect<E[P]> | boolean : boolean;

  L39:  };

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Cannot find name 'infer'. 


  L43:  export declare type FindOptionsWhere<E> = {

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L45:  } | {


        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L45:  } | {


        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L45:  } | {


        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere
  L45:  } | {

        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:   E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> :
  L45:  } | {


        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  ]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E
  L45:  } | {


        Cannot find name 'infer'. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Objec
  L45:  } | {

        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:  )[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? Find
  L45:  } | {



        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:   R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? Fi

  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Cannot find name 'R'. 


  L43:  export declare type FindOptionsWhere<E> = {

  L44:  <R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindA
  L45:  } | {


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:   E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOpe
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Cannot find name 'P'. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  [P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOpera
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Value of type 'typeof FindOperator' is not callable. Did you mean to include 'new'? 


  L43:  export declare type FindOptionsWhere<E> = {

  L44:  s (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Obj                                                                                                                       
  L45:  } | {


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  ndOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Cannot find name 'P'. 

  L43:  export declare type FindOptionsWhere<E> = {

  L44:  OptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> 
  L45:  } | {


        'FindAltOperator' only refers to a type, but is being used as a value here. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  dOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]>
  L45:  } | {

        Cannot find name 'E'. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:   extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> |
  L45:  } | {

        Cannot find name 'P'. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  xtends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | F
  L45:  } | {

        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  extends Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | 
  L45:  } | {

        Cannot find name 'E'. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  rator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | 
  L45:  } | {

        Cannot find name 'P'. 

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  tor<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[

  L45:  } | {

        Value of type 'typeof FindOperator' is not callable. Did you mean to include 'new'? 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {

  L44:  Object ? FindOperator<E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltO                    
  L45:  } | {


        Cannot find name 'E'. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        Cannot find name 'P'. 

  L43:  export declare type FindOptionsWhere<E> = {

  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        'FindAltOperator' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {


        Cannot find name 'E'. 

  L43:  export declare type FindOptionsWhere<E> = {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

  L43:  export declare type FindOptionsWhere<E> = {
  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 44

        Cannot find name 'P'. 


  L43:  export declare type FindOptionsWhere<E> = {

  L44:  <E[P]> | FindAltOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | FindAltOperator<E[P]> | E[P];
  L45:  } | {


        A computed property name must be of type 'string', 'number', 'symbol', or 'any'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];

        Cannot find name 'keyof'. 

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp

  L47:  }[];


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Cannot find name 'P'. 


  L45:  } | {

  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];


        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

  L45:  } | {
  L46:      [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOp
  L47:  }[];

        Cannot find name 'R'. 

  L45:  } | {
  L46:  keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere
  L47:  }[];

        Cannot find name 'E'. 

  L45:  } | {
  L46:   E]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> :
  L47:  }[];

        Cannot find name 'P'. 

  L45:  } | {
  L46:  ]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E
  L47:  }[];

        An object literal cannot have multiple properties with the same name in strict mode. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  ]?: E[P] extends (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E
  L47:  }[];

        Cannot find name 'infer'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  (infer R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Objec
  L47:  }[];


        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:   R)[] ? FindOptionsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? Fi
  L47:  }[];


        Cannot find name 'R'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  <R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindO
  L47:  }[];


        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:   E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOption
  L47:  }[];


        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  [P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsW
  L47:  }[];


        An object literal cannot have multiple properties with the same name in strict mode. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  [P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsW
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Value of type 'typeof FindOperator' is not callable. Did you mean to include 'new'? 


  L45:  } | {

  L46:  onsWhere<R> : E[P] extends Promise<infer R> ? FindOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]>                                                     

  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Cannot find name 'E'. 

  L45:  } | {
  L46:  ndOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> |

  L47:  }[];

        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  OptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        'FindOptionsWhere' only refers to a type, but is being used as a value here. 

  L45:  } | {

  L46:  dOptionsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | 
  L47:  }[];

        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

        Cannot find name 'P'. 

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46
[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Value of type 'typeof FindOperator' is not callable. Did you mean to include 'new'? 

  L45:  } | {

  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];

  L47:  }[];

        Cannot find name 'E'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

        Cannot find name 'P'. 

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

        Cannot find name 'E'. 

  L45:  } | {
  L46:  onsWhere<R> : E[P] extends Object ? FindOperator<E[P]> | FindOptionsWhere<E[P]> : FindOperator<E[P]> | E[P];
  L47:  }[];

[13:51:53] typescript: node_modules/typeorm/find-options/FindOptions.d.ts, line: 46

Static's on entity is undefined

If I define a static variable on a entity class it is undefined at runtime even though my IDE seems to think it should work just fine. Is this expected in TypeORM?

'await' expression is only allowed within an async function.

Getting the following error:

typescript: src/app/app.component.ts, line: 42
            'await' expression is only allowed within an async function.

bildschirmfoto von 2018-01-18 15-37-03

package.json

{
    ...
    "config": {
        "ionic_webpack": "./config/webpack.config.js"
    },
    "dependencies": {
        "@angular/common": "5.0.3",
        "@angular/compiler": "5.0.3",
        "@angular/compiler-cli": "5.0.3",
        "@angular/core": "5.0.3",
        "@angular/forms": "5.0.3",
        "@angular/http": "5.0.3",
        "@angular/platform-browser": "5.0.3",
        "@angular/platform-browser-dynamic": "5.0.3",
        "@ionic-native/core": "4.4.0",
        "@ionic-native/splash-screen": "4.4.0",
        "@ionic-native/status-bar": "4.4.0",
        "@ionic/storage": "2.1.3",
        "@types/node": "^9.3.0",
        "cordova-android": "^6.2.3",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-ionic-webview": "^1.1.16",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.4.1",
        "cordova-plugin-whitelist": "^1.3.1",
        "cordova-sqlite-storage": "^2.2.0",
        "ionic-angular": "3.9.2",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.5.2",
        "sw-toolbox": "3.6.0",
        "typeorm": "^0.1.11",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.1.6",
        "typescript": "2.4.2"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-sqlite-storage": {},
            "cordova-plugin-ionic-webview": {}
        },
        "platforms": [
            "android"
        ]
    }
}

I've noticed only two major difference to your package.json:

  • angular 5.0.3 instead of angular 4.4.3
  • typescript 2.4.2 instead of typescript 2.3.4

Any idea, what went wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.