Skip to content

Commit 87692e3

Browse files
authored
refactor: use T[] array style on main client (#399)
1 parent a301de7 commit 87692e3

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

packages/clients/src/api/account/v2alpha1/types.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type ListSSHKeysRequestOrderBy =
1111

1212
/** List ssh keys response */
1313
export interface ListSSHKeysResponse {
14-
sshKeys: Array<SSHKey>
14+
sshKeys: SSHKey[]
1515
totalCount: number
1616
}
1717

packages/clients/src/helpers/marshalling.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ export const unmarshalArrayOfObject = <T, B extends boolean>(
119119
data: unknown,
120120
unmarshaller: (input: unknown) => T,
121121
emptyFallback: B = true as B,
122-
): B extends true ? Array<T> | undefined : Array<T> => {
122+
): B extends true ? T[] | undefined : T[] => {
123123
if (!Array.isArray(data)) {
124124
return (emptyFallback ? [] : undefined) as B extends true
125-
? Array<T> | undefined
126-
: Array<T>
125+
? T[] | undefined
126+
: T[]
127127
}
128128

129129
return data.map(elt => unmarshaller(elt))

packages/clients/src/scw/custom-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface TimeSeries {
5353
/** Name of the metric. */
5454
name: string
5555
/** Points contains all the points that composed the series. */
56-
points: Array<TimeSeriesPoint>
56+
points: TimeSeriesPoint[]
5757
/** Metadata contains some string metadata related to a metric. */
5858
metadata: Record<string, string>
5959
}

packages/clients/src/scw/errors/standard/invalid-arguments-error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type InvalidArgumentsErrorDetails = {
2121
*
2222
* @internal
2323
*/
24-
const buildMessage = (list: Array<InvalidArgumentsErrorDetails>): string => {
24+
const buildMessage = (list: InvalidArgumentsErrorDetails[]): string => {
2525
const invalidArgs: string[] = list.reduce<string[]>((acc, details) => {
2626
let readableReason = ''
2727
switch (details.reason) {
@@ -58,7 +58,7 @@ export class InvalidArgumentsError extends ScalewayError {
5858
constructor(
5959
readonly status: number,
6060
readonly body: JSONObject,
61-
readonly details: Array<InvalidArgumentsErrorDetails>,
61+
readonly details: InvalidArgumentsErrorDetails[],
6262
) {
6363
super(status, body, buildMessage(details))
6464
this.name = 'InvalidArgumentsError'

packages/clients/src/scw/errors/standard/permissions-denied-error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type PermissionsDeniedErrorDetails = {
2020
*
2121
* @internal
2222
*/
23-
const buildMessage = (list: Array<PermissionsDeniedErrorDetails>): string =>
23+
const buildMessage = (list: PermissionsDeniedErrorDetails[]): string =>
2424
`insufficient permissions: ${list
2525
.map(({ action, resource }) => `${action} ${resource}`)
2626
.join('; ')}`
@@ -34,7 +34,7 @@ export class PermissionsDeniedError extends ScalewayError {
3434
constructor(
3535
readonly status: number,
3636
readonly body: JSONObject,
37-
readonly list: Array<PermissionsDeniedErrorDetails>,
37+
readonly list: PermissionsDeniedErrorDetails[],
3838
) {
3939
super(status, body, buildMessage(list))
4040
this.name = 'PermissionsDeniedError'

packages/clients/src/scw/errors/standard/quotas-exceeded-error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type QuotasExceededErrorDetails = {
3232
*
3333
* @internal
3434
*/
35-
const buildMessage = (list: Array<QuotasExceededErrorDetails>): string =>
35+
const buildMessage = (list: QuotasExceededErrorDetails[]): string =>
3636
`quota exceeded(s): ${list
3737
.map(details => {
3838
const message = `${details.resource} has reached its quota (${details.current}/${details.quota})`
@@ -68,7 +68,7 @@ export class QuotasExceededError extends ScalewayError {
6868
constructor(
6969
readonly status: number,
7070
readonly body: JSONObject,
71-
readonly list: Array<QuotasExceededErrorDetails>,
71+
readonly list: QuotasExceededErrorDetails[],
7272
) {
7373
super(status, body, buildMessage(list))
7474
this.name = 'QuotasExceededError'

0 commit comments

Comments
 (0)