Skip to content

Commit

Permalink
Fix compilation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daogrady committed Aug 14, 2024
1 parent 1fff36d commit 93f5e08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apis/internal/inference.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ArrayConstructable<T = any> {
// concrete singular type.
// `SingularType<typeof Books>` == `Book`.
export type SingularInstanceType<T extends ArrayConstructable> = InstanceType<T>[number]
export type PluralInstanceType<T extends Constructable> = InstanceType<Array<T>>
export type PluralInstanceType<T extends Constructable> = Array<InstanceType<T>>

// Convenient way of unwrapping the inner type from array-typed values, as well as the value type itself
// `class MyArray<T> extends Array<T>``
Expand Down
4 changes: 3 additions & 1 deletion apis/ql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { _TODO } from './internal/util'

export type Query = CQN.Query

export { QLExtensions } from './internal/query'

// this just serves as a reminder that we can not get rid of some of the anys at this point
// as the would refer to the generic type of the surrounding class
type StaticAny = any
Expand All @@ -52,7 +54,7 @@ export type StaticSELECT<T> = typeof SELECT<T>
& SELECT_from<T> // as it is not directly quantified, ...
& SELECT_one<T> // ...we should expect both a scalar and a list

declare class QL<T> {
export declare class QL<T> {

SELECT: StaticSELECT<T>

Expand Down
7 changes: 4 additions & 3 deletions apis/services.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { SELECT, INSERT, UPDATE, DELETE, Query, ConstructedQuery, UPSERT } from './ql'
import { Awaitable } from './ql'
import { Awaitable } from './internal/query'
import { ArrayConstructable, Constructable, Unwrap } from './internal/inference'
//import { ModelPart, CSN, LinkedDefinition, LinkedEntity } from './linked'
import * as linked from './linked'
import * as csn from './csn'
import { EventContext } from './events'
import { Request } from './events'
import { ReadableStream } from 'node:stream/web'
import { _TODO } from './internal/util'

type Key = number | string | any

Expand Down Expand Up @@ -58,7 +59,7 @@ export class QueryAPI {
* @see [docs](https://cap.cloud.sap/docs/node.js/core-services#crud-style-api)
*/
run: {
(query: ConstructedQuery | ConstructedQuery[]): Promise<ResultSet | any>,
(query: ConstructedQuery<_TODO> | ConstructedQuery<_TODO>[]): Promise<ResultSet | any>,
(query: Query): Promise<ResultSet | any>,
(query: string, args?: any[] | object): Promise<ResultSet | any>,
}
Expand Down Expand Up @@ -177,7 +178,7 @@ export class Service extends QueryAPI {
<T = any>(event: types.event, path: string, data?: object, headers?: object): Promise<T>,
<T = any>(event: types.event, data?: object, headers?: object): Promise<T>,
<T = any>(details: { event: types.event, data?: object, headers?: object }): Promise<T>,
<T = any>(details: { query: ConstructedQuery, data?: object, headers?: object }): Promise<T>,
<T = any>(details: { query: ConstructedQuery<T>, data?: object, headers?: object }): Promise<T>,
<T = any>(details: { method: types.eventName, path: string, data?: object, headers?: object }): Promise<T>,
<T = any>(details: { event: types.eventName, entity: linked.Definition | string, data?: object, params?: object, headers?: object }): Promise<T>,
}
Expand Down

0 comments on commit 93f5e08

Please sign in to comment.