feat: enable stricter typescript compiler options

This commit is contained in:
2024-01-05 11:55:15 +01:00
parent 7e779b738e
commit 33181941ba
58 changed files with 185 additions and 138 deletions

View File

@@ -128,8 +128,8 @@ export class Client {
size: 1,
});
if (response.data.length === 1 && response.data[0].uid === uid) {
return response.data[0];
if (response.data.length === 1 && response.data[0]!.uid === uid) {
return response.data[0]!;
}
throw new SCInternalServerErrorResponse(new SCNotFoundErrorResponse(true), true);
@@ -220,11 +220,11 @@ export class Client {
for (const key of Object.keys(multiSearchRequest)) {
const searchRequest = multiSearchRequest[key];
if (searchRequest.size === undefined) {
if (searchRequest?.size === undefined) {
preFlightRequest[key] = {
...searchRequest,
};
preFlightRequest[key].size = 0;
preFlightRequest[key]!.size = 0;
preFlightNecessary = true;
}
}
@@ -245,8 +245,8 @@ export class Client {
);
// set size for multi search requests that were in pre flight request
for (const key of Object.keys(preFlightRequest)) {
returnMultiSearchRequest[key].size = preFlightResponse[key].pagination.total;
for (const key in preFlightRequest) {
returnMultiSearchRequest[key]!.size = preFlightResponse[key]!.pagination.total;
}
}

View File

@@ -212,7 +212,7 @@ export class ConnectorClient extends Client {
const thingSource = source === undefined ? 'stapps-api' : source;
// request a new bulk
const bulk = await this.bulk(things[0].type, thingSource, timeout);
const bulk = await this.bulk(things[0]!.type, thingSource, timeout);
// add items to the bulk - 5 concurrently
await Promise.all(

View File

@@ -33,7 +33,7 @@ export class ApiError extends Error {
/**
* Add additional data to the output of the error
*/
toString(): string {
override toString(): string {
let string_ = super.toString();
// add additional data