Skip to content

Commit e5c925e

Browse files
committed
fix: ESLint and TS errors
1 parent d12288c commit e5c925e

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

example/src/Database.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ export async function typeORMGetBooks() {
5050
return result;
5151
}
5252

53-
export async function executeFailingTypeORMQuery() {
53+
export async function executeFailingTypeORMQuery(): Promise<QueryResult | void> {
5454
const bookRepository = datasource.getRepository(Book);
5555

5656
try {
5757
const manualQuery = (await bookRepository.query(`
5858
SELECT * From UnexistingTable
59-
`)) as QueryResult<Book>;
59+
`)) as QueryResult;
6060
return manualQuery;
6161
} catch (e) {
6262
console.warn('should have cached');

example/src/model/Book.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import 'reflect-metadata';
2-
import {
3-
Entity,
4-
Column,
5-
PrimaryGeneratedColumn,
6-
OneToOne,
7-
JoinColumn,
8-
} from 'typeorm/browser';
2+
import {Entity, Column, PrimaryGeneratedColumn} from 'typeorm/browser';
93
import {BaseEntity} from 'typeorm';
104

115
@Entity()

example/src/model/User.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export class User {
2020
// favoriteBook!: Book;
2121

2222
@Column('simple-json')
23-
metadata: {nickname: string};
23+
metadata: {nickname: string} | undefined;
2424

2525
@Column('blob')
26-
avatar: ArrayBuffer;
26+
avatar: ArrayBuffer | undefined;
2727
}

example/src/tests/unitTests.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
import {beforeEach, describe, it} from './MochaRNAdapter';
77
import chai from 'chai';
88
import {testDb as testDbInternal, resetTestDb} from './db';
9+
import type {User} from '../model/User';
910

1011
function isError(e: unknown): e is Error {
1112
return e instanceof Error;
@@ -219,7 +220,8 @@ export function registerUnitTests() {
219220
[id],
220221
);
221222

222-
actual.push(results.rows?._array[0]?.networth);
223+
const row = results.rows?._array[0] as User | undefined;
224+
actual.push(row?.networth);
223225
});
224226

225227
promises.push(promised);
@@ -513,7 +515,8 @@ export function registerUnitTests() {
513515
[id],
514516
);
515517

516-
actual.push(results.rows?._array[0]?.networth);
518+
const row = results.rows?._array[0] as User | undefined;
519+
actual.push(row?.networth);
517520
});
518521

519522
promises.push(promised);

0 commit comments

Comments
 (0)