Skip to content

Commit 5b4e721

Browse files
authored
chore(packages): use Record in place of Object (#3680)
1 parent b987a88 commit 5b4e721

File tree

44 files changed

+69
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+69
-68
lines changed

packages/config-resolver/src/endpointsConfig/NodeUseDualstackEndpointConfigOptions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS", () => {
1414
jest.clearAllMocks();
1515
});
1616

17-
const test = (func: Function, obj: { [key: string]: string }, key: string, type: SelectorType) => {
17+
const test = (func: Function, obj: Record<string, string>, key: string, type: SelectorType) => {
1818
it.each([true, false, undefined])("returns %s", (output) => {
1919
(booleanSelector as jest.Mock).mockReturnValueOnce(output);
2020
expect(func(obj)).toEqual(output);

packages/config-resolver/src/endpointsConfig/NodeUseFipsEndpointConfigOptions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS", () => {
1414
jest.clearAllMocks();
1515
});
1616

17-
const test = (func: Function, obj: { [key: string]: string }, key: string, type: SelectorType) => {
17+
const test = (func: Function, obj: Record<string, string>, key: string, type: SelectorType) => {
1818
it.each([true, false, undefined])("returns %s", (output) => {
1919
(booleanSelector as jest.Mock).mockReturnValueOnce(output);
2020
expect(func(obj)).toEqual(output);

packages/config-resolver/src/regionInfo/PartitionHash.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { EndpointVariant } from "./EndpointVariant";
55
* The information includes the list of regions belonging to that partition,
66
* and the hostname to be used for the partition.
77
*/
8-
export type PartitionHash = {
9-
[key: string]: {
8+
export type PartitionHash = Record<
9+
string,
10+
{
1011
regions: string[];
1112
regionRegex: string;
1213
variants: EndpointVariant[];
1314
endpoint?: string;
14-
};
15-
};
15+
}
16+
>;

packages/config-resolver/src/regionInfo/RegionHash.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { EndpointVariant } from "./EndpointVariant";
44
* The hash of region with the information specific to that region.
55
* The information can include hostname, signingService and signingRegion.
66
*/
7-
export type RegionHash = {
8-
[key: string]: {
7+
export type RegionHash = Record<
8+
string,
9+
{
910
variants: EndpointVariant[];
1011
signingService?: string;
1112
signingRegion?: string;
12-
};
13-
};
13+
}
14+
>;

packages/credential-provider-cognito-identity/src/InMemoryStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Storage } from "./Storage";
22

33
export class InMemoryStorage implements Storage {
4-
constructor(private store: { [key: string]: string } = {}) {}
4+
constructor(private store: Record<string, string> = {}) {}
55

66
getItem(key: string): string | null {
77
if (key in this.store) {

packages/credential-provider-ini/src/resolveAssumeRoleCredentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const resolveAssumeRoleCredentials = async (
6868
profileName: string,
6969
profiles: ParsedIniData,
7070
options: FromIniInit,
71-
visitedProfiles: { [profileName: string]: true } = {}
71+
visitedProfiles: Record<string, true> = {}
7272
) => {
7373
const data = profiles[profileName];
7474

packages/credential-provider-ini/src/resolveCredentialSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { CredentialProvider } from "@aws-sdk/types";
1111
* fromIni() is called.
1212
*/
1313
export const resolveCredentialSource = (credentialSource: string, profileName: string): CredentialProvider => {
14-
const sourceProvidersMap: { [name: string]: () => CredentialProvider } = {
14+
const sourceProvidersMap: Record<string, () => CredentialProvider> = {
1515
EcsContainer: fromContainerMetadata,
1616
Ec2InstanceMetadata: fromInstanceMetadata,
1717
Environment: fromEnv,

packages/credential-provider-ini/src/resolveProfileData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const resolveProfileData = async (
1111
profileName: string,
1212
profiles: ParsedIniData,
1313
options: FromIniInit,
14-
visitedProfiles: { [profileName: string]: true } = {}
14+
visitedProfiles: Record<string, true> = {}
1515
): Promise<Credentials> => {
1616
const data = profiles[profileName];
1717

packages/eventstream-serde-browser/src/EventStreamMarshaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class EventStreamMarshaller {
4040

4141
deserialize<T>(
4242
body: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>,
43-
deserializer: (input: { [event: string]: Message }) => Promise<T>
43+
deserializer: (input: Record<string, Message>) => Promise<T>
4444
): AsyncIterable<T> {
4545
const bodyIterable = isReadableStream(body) ? readableStreamtoIterable(body) : body;
4646
return this.universalMarshaller.deserialize(bodyIterable, deserializer);

packages/eventstream-serde-node/src/EventStreamMarshaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class EventStreamMarshaller {
2323
});
2424
}
2525

26-
deserialize<T>(body: Readable, deserializer: (input: { [event: string]: Message }) => Promise<T>): AsyncIterable<T> {
26+
deserialize<T>(body: Readable, deserializer: (input: Record<string, Message>) => Promise<T>): AsyncIterable<T> {
2727
//should use stream[Symbol.asyncIterable] when the api is stable
2828
//reference: https://nodejs.org/docs/latest-v11.x/api/stream.html#stream_readable_symbol_asynciterator
2929
const bodyIterable: AsyncIterable<Uint8Array> =

packages/eventstream-serde-universal/src/EventStreamMarshaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class EventStreamMarshaller {
2121

2222
deserialize<T>(
2323
body: AsyncIterable<Uint8Array>,
24-
deserializer: (input: { [event: string]: Message }) => Promise<T>
24+
deserializer: (input: Record<string, Message>) => Promise<T>
2525
): AsyncIterable<T> {
2626
const chunkedStream = getChunkedStream(body);
2727
const unmarshalledStream = getUnmarshalledStream(chunkedStream, {

packages/eventstream-serde-universal/src/getUnmarshalledStream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { Encoder, Message } from "@aws-sdk/types";
33

44
export type UnmarshalledStreamOptions<T> = {
55
eventMarshaller: EventMarshaller;
6-
deserializer: (input: { [name: string]: Message }) => Promise<T>;
6+
deserializer: (input: Record<string, Message>) => Promise<T>;
77
toUtf8: Encoder;
88
};
99

10-
export function getUnmarshalledStream<T extends { [key: string]: any }>(
10+
export function getUnmarshalledStream<T extends Record<string, any>>(
1111
source: AsyncIterable<Uint8Array>,
1212
options: UnmarshalledStreamOptions<T>
1313
): AsyncIterable<T> {

packages/middleware-bucket-endpoint/src/NodeDisableMultiregionAccessPointConfigOptions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("NODE_USE_ARN_REGION_CONFIG_OPTIONS", () => {
1313
jest.clearAllMocks();
1414
});
1515

16-
const test = (func: Function, obj: { [key: string]: string }, key: string, type: SelectorType) => {
16+
const test = (func: Function, obj: Record<string, string>, key: string, type: SelectorType) => {
1717
it.each([true, false, undefined])("returns %s", (output) => {
1818
(booleanSelector as jest.Mock).mockReturnValueOnce(output);
1919
expect(func(obj)).toEqual(output);

packages/middleware-bucket-endpoint/src/NodeUseArnRegionConfigOptions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("NODE_USE_ARN_REGION_CONFIG_OPTIONS", () => {
1313
jest.clearAllMocks();
1414
});
1515

16-
const test = (func: Function, obj: { [key: string]: string }, key: string, type: SelectorType) => {
16+
const test = (func: Function, obj: Record<string, string>, key: string, type: SelectorType) => {
1717
it.each([true, false, undefined])("returns %s", (output) => {
1818
(booleanSelector as jest.Mock).mockReturnValueOnce(output);
1919
expect(func(obj)).toEqual(output);

packages/middleware-endpoint-discovery/src/getCacheKey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getCacheKey = async (
77
commandName: string,
88
config: { credentials: Provider<Credentials> },
99
options: {
10-
identifiers?: { [key: string]: string };
10+
identifiers?: Record<string, string>;
1111
}
1212
) => {
1313
const { accessKeyId } = await config.credentials();

packages/middleware-endpoint-discovery/src/getEndpointDiscoveryPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface EndpointDiscoveryMiddlewareConfig {
1414
isDiscoveredEndpointRequired: boolean;
1515
clientStack: MiddlewareStack<any, any>;
1616
options?: HttpHandlerOptions;
17-
identifiers?: { [key: string]: string };
17+
identifiers?: Record<string, string>;
1818
}
1919

2020
export const getEndpointDiscoveryPlugin = (

packages/middleware-endpoint-discovery/src/updateDiscoveredEndpointInCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface UpdateDiscoveredEndpointInCacheOptions extends EndpointDiscover
77
endpointDiscoveryCommandCtor: new (comandConfig: any) => any;
88
}
99

10-
const requestQueue: { [key: string]: { resolve: Function; reject: Function }[] } = {};
10+
const requestQueue: Record<string, { resolve: Function; reject: Function }[]> = {};
1111

1212
export const updateDiscoveredEndpointInCache = async (
1313
config: EndpointDiscoveryResolvedConfig & PreviouslyResolved,

packages/middleware-sdk-eventbridge/src/inject-endpoint-id.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("injectEndpointIdMiddleware", () => {
1616

1717
const invokeMiddleware = async (
1818
config: InjectEndpointIdMiddlewareConfig
19-
): Promise<{ hostname: string; middlewareContext: { [key: string]: any } }> => {
19+
): Promise<{ hostname: string; middlewareContext: Record<string, any> }> => {
2020
const mockNextHandler = jest.fn();
2121
const middlewareContext = {} as any;
2222
const handler = injectEndpointIdMiddleware({ ...config })(mockNextHandler, middlewareContext);

packages/middleware-sdk-rds/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { formatUrl } from "@aws-sdk/util-format-url";
1818

1919
const regARN = /arn:[\w+=/,.@-]+:[\w+=/,.@-]+:([\w+=/,.@-]*)?:[0-9]+:[\w+=/,.@-]+(:[\w+=/,.@-]+)?(:[\w+=/,.@-]+)?/;
2020

21-
const sourceIdToCommandKeyMap: { [key: string]: string } = {
21+
const sourceIdToCommandKeyMap: Record<string, string> = {
2222
SourceDBSnapshotIdentifier: "CopyDBSnapshot",
2323
SourceDBInstanceIdentifier: "CreateDBInstanceReadReplica",
2424
ReplicationSourceIdentifier: "CreateDBCluster", // This key is optional.

packages/middleware-sdk-sqs/src/send-message-batch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const sendMessageBatchMiddleware =
2828
const resp = await next({ ...args });
2929
const output = resp.output as unknown as SendMessageBatchResult;
3030
const messageIds = [];
31-
const entries: { [index: string]: SendMessageBatchResultEntry } = {};
31+
const entries: Record<string, SendMessageBatchResultEntry> = {};
3232
if (output.Successful !== undefined) {
3333
for (const entry of output.Successful) {
3434
if (entry.Id !== undefined) {

packages/middleware-stack/src/MiddlewareStack.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ export const constructStack = <Input extends object, Output extends object>(): M
9898
const getMiddlewareList = (): Array<MiddlewareType<Input, Output>> => {
9999
const normalizedAbsoluteEntries: Normalized<AbsoluteMiddlewareEntry<Input, Output>, Input, Output>[] = [];
100100
const normalizedRelativeEntries: Normalized<RelativeMiddlewareEntry<Input, Output>, Input, Output>[] = [];
101-
const normalizedEntriesNameMap: {
102-
[middlewareName: string]: Normalized<MiddlewareEntry<Input, Output>, Input, Output>;
103-
} = {};
101+
const normalizedEntriesNameMap: Record<string, Normalized<MiddlewareEntry<Input, Output>, Input, Output>> = {};
104102

105103
absoluteEntries.forEach((entry) => {
106104
const normalizedEntry = {

packages/middleware-stack/src/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface NormalizedRelativeEntry<Input extends object, Output extends ob
3232
priority: null;
3333
}
3434

35-
export type NamedMiddlewareEntriesMap<Input extends object, Output extends object> = {
36-
[key: string]: MiddlewareEntry<Input, Output>;
37-
};
35+
export type NamedMiddlewareEntriesMap<Input extends object, Output extends object> = Record<
36+
string,
37+
MiddlewareEntry<Input, Output>
38+
>;

packages/s3-presigned-post/src/createPresignedPost.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from "./constants";
1515
import { Conditions as PolicyEntry } from "./types";
1616

17-
type Fields = { [key: string]: string };
17+
type Fields = Record<string, string>;
1818

1919
export interface PresignedPostOptions {
2020
Bucket: string;

packages/s3-presigned-post/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type EqualCondition = ["eq", string, string] | { [key: string]: string };
1+
type EqualCondition = ["eq", string, string] | Record<string, string>;
22

33
type StartsWithCondition = ["starts-with", string, string];
44

packages/shared-ini-file-loader/src/getProfileData.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe(getProfileData.name, () => {
2929
const getMockOutput = (profileNames: string[]) =>
3030
profileNames.reduce((acc, profileName) => ({ ...acc, [profileName]: getMockProfileData(profileName) }), {});
3131

32-
const getMockInput = (mockOutput: { [key: string]: { [key: string]: string } }) =>
32+
const getMockInput = (mockOutput: Record<string, Record<string, string>>) =>
3333
Object.entries(mockOutput).reduce((acc, [key, value]) => ({ ...acc, [`profile ${key}`]: value }), {});
3434

3535
it("single profile", () => {

packages/shared-ini-file-loader/src/parseIni.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe(parseIni.name, () => {
1212
const mockProfileName = "mock_profile_name";
1313
const mockProfileData = { key: "value" };
1414

15-
const getMockProfileData = (profileName: string, profileData: { [key: string]: string }) =>
15+
const getMockProfileData = (profileName: string, profileData: Record<string, string>) =>
1616
`[${profileName}]\n${Object.entries(profileData)
1717
.map(([key, value]) => `${key} = ${value}`)
1818
.join("\n")}\n`;

packages/shared-ini-file-loader/src/slurpFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { promises as fsPromises } from "fs";
33

44
const { readFile } = fsPromises;
55

6-
const filePromisesHash: { [key: string]: Promise<string> } = {};
6+
const filePromisesHash: Record<string, Promise<string>> = {};
77

88
export const slurpFile = (path: string) => {
99
if (!filePromisesHash[path]) {

packages/signature-v4/src/credentialDerivation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { toHex } from "@aws-sdk/util-hex-encoding";
33

44
import { KEY_TYPE_IDENTIFIER, MAX_CACHE_SIZE } from "./constants";
55

6-
const signingKeyCache: { [key: string]: Uint8Array } = {};
6+
const signingKeyCache: Record<string, Uint8Array> = {};
77
const cacheQueue: Array<string> = [];
88

99
/**

packages/signature-v4/src/getCanonicalQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { SIGNATURE_HEADER } from "./constants";
88
*/
99
export const getCanonicalQuery = ({ query = {} }: HttpRequest): string => {
1010
const keys: Array<string> = [];
11-
const serialized: { [key: string]: string } = {};
11+
const serialized: Record<string, string> = {};
1212
for (const key of Object.keys(query).sort()) {
1313
if (key.toLowerCase() === SIGNATURE_HEADER) {
1414
continue;

packages/smithy-client/src/exceptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class ServiceException extends Error implements SmithyException, Metadata
4343
*/
4444
export const decorateServiceException = <E extends ServiceException>(
4545
exception: E,
46-
additions: { [key: string]: any } = {}
46+
additions: Record<string, any> = {}
4747
): E => {
4848
// apply additional properties to deserialized ServiceException object
4949
Object.entries(additions)

packages/smithy-client/src/parse-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export const expectNonNull = <T>(value: T | null | undefined, location?: string)
195195
* @returns The value if it's an object, undefined if it's null/undefined,
196196
* otherwise an error is thrown.
197197
*/
198-
export const expectObject = (value: any): { [key: string]: any } | undefined => {
198+
export const expectObject = (value: any): Record<string, any> | undefined => {
199199
if (value === null || value === undefined) {
200200
return undefined;
201201
}
@@ -231,7 +231,7 @@ export const expectString = (value: any): string | undefined => {
231231
* @return the value if it's a union, undefined if it's null/undefined, otherwise
232232
* an error is thrown.
233233
*/
234-
export const expectUnion = (value: unknown): { [key: string]: any } | undefined => {
234+
export const expectUnion = (value: unknown): Record<string, any> | undefined => {
235235
if (value === null || value === undefined) {
236236
return undefined;
237237
}

packages/types/src/eventStream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export interface EventStreamSerdeContext {
9090
}
9191

9292
export interface EventStreamMarshaller {
93-
deserialize: (body: any, deserializer: (input: { [event: string]: Message }) => any) => AsyncIterable<any>;
93+
deserialize: (body: any, deserializer: (input: Record<string, Message>) => any) => AsyncIterable<any>;
9494
serialize: (input: AsyncIterable<any>, serializer: (event: any) => Message) => any;
9595
}
9696

packages/util-base64-browser/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const alphabetByEncoding: { [key: string]: number } = {};
1+
const alphabetByEncoding: Record<string, number> = {};
22
const alphabetByValue: Array<string> = new Array(64);
33

44
for (let i = 0, start = "A".charCodeAt(0), limit = "Z".charCodeAt(0); i + start <= limit; i++) {

packages/util-config-provider/src/booleanSelector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export enum SelectorType {
1111
*
1212
* @internal
1313
*/
14-
export const booleanSelector = (obj: { [key: string]: string | undefined }, key: string, type: SelectorType) => {
14+
export const booleanSelector = (obj: Record<string, string | undefined>, key: string, type: SelectorType) => {
1515
if (!(key in obj)) return undefined;
1616
if (obj[key] === "true") return true;
1717
if (obj[key] === "false") return false;

packages/util-dynamodb/src/convertToAttr.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ describe("convertToAttr", () => {
349349
stringSet: { SS: ["one", "two", "three"] },
350350
},
351351
},
352-
] as { input: { [key: string]: NativeAttributeValue }; output: { [key: string]: AttributeValue } }[]
352+
] as { input: Record<string, NativeAttributeValue>; output: Record<string, AttributeValue> }[]
353353
).forEach(({ input, output }) => {
354354
[true, false].forEach((useObjectCreate) => {
355355
const inputObject = useObjectCreate ? Object.create(input) : input;
@@ -506,7 +506,7 @@ describe("convertToAttr", () => {
506506
private readonly bigintAttr: bigint,
507507
private readonly binaryAttr: Uint8Array,
508508
private readonly listAttr: any[],
509-
private readonly mapAttr: { [key: string]: any }
509+
private readonly mapAttr: Record<string, any>
510510
) {}
511511
public exampleMethod() {
512512
return "This method won't be marshalled";

packages/util-dynamodb/src/convertToAttr.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const convertToAttr = (data: NativeAttributeValue, options?: marshallOpti
2525
// for object which is result of Object.create(null), which doesn't have constructor defined
2626
(!data.constructor && typeof data === "object")
2727
) {
28-
return convertToMapAttrFromEnumerableProps(data as { [key: string]: NativeAttributeValue }, options);
28+
return convertToMapAttrFromEnumerableProps(data as Record<string, NativeAttributeValue>, options);
2929
} else if (isBinary(data)) {
3030
if (data.length === 0 && options?.convertEmptyValues) {
3131
return convertToNullAttr();
@@ -45,7 +45,7 @@ export const convertToAttr = (data: NativeAttributeValue, options?: marshallOpti
4545
}
4646
return convertToStringAttr(data);
4747
} else if (options?.convertClassInstanceToMap && typeof data === "object") {
48-
return convertToMapAttrFromEnumerableProps(data as { [key: string]: NativeAttributeValue }, options);
48+
return convertToMapAttrFromEnumerableProps(data as Record<string, NativeAttributeValue>, options);
4949
}
5050
throw new Error(
5151
`Unsupported type passed: ${data}. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.`
@@ -110,9 +110,9 @@ const convertToSetAttr = (
110110
const convertToMapAttrFromIterable = (
111111
data: Map<string, NativeAttributeValue>,
112112
options?: marshallOptions
113-
): { M: { [key: string]: AttributeValue } } => ({
113+
): { M: Record<string, AttributeValue> } => ({
114114
M: ((data) => {
115-
const map: { [key: string]: AttributeValue } = {};
115+
const map: Record<string, AttributeValue> = {};
116116
for (const [key, value] of data) {
117117
if (typeof value !== "function" && (value !== undefined || !options?.removeUndefinedValues)) {
118118
map[key] = convertToAttr(value, options);
@@ -123,11 +123,11 @@ const convertToMapAttrFromIterable = (
123123
});
124124

125125
const convertToMapAttrFromEnumerableProps = (
126-
data: { [key: string]: NativeAttributeValue },
126+
data: Record<string, NativeAttributeValue>,
127127
options?: marshallOptions
128-
): { M: { [key: string]: AttributeValue } } => ({
128+
): { M: Record<string, AttributeValue> } => ({
129129
M: ((data) => {
130-
const map: { [key: string]: AttributeValue } = {};
130+
const map: Record<string, AttributeValue> = {};
131131
for (const key in data) {
132132
const value = data[key];
133133
if (typeof value !== "function" && (value !== undefined || !options?.removeUndefinedValues)) {

0 commit comments

Comments
 (0)