File tree Expand file tree Collapse file tree 4 files changed +10
-13
lines changed
Expand file tree Collapse file tree 4 files changed +10
-13
lines changed Original file line number Diff line number Diff 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' ) ;
Original file line number Diff line number Diff line change 11import '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' ;
93import { BaseEntity } from 'typeorm' ;
104
115@Entity ( )
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type {
66import { beforeEach , describe , it } from './MochaRNAdapter' ;
77import chai from 'chai' ;
88import { testDb as testDbInternal , resetTestDb } from './db' ;
9+ import type { User } from '../model/User' ;
910
1011function 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 ) ;
You can’t perform that action at this time.
0 commit comments