Skip to content

chore(packages): replace Object interface with Record type #3683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/credential-provider-cognito-identity/src/Logins.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { Provider } from "@aws-sdk/types";

export interface Logins {
[providerName: string]: string | Provider<string>;
}
export type Logins = Record<string, string | Provider<string>>;

export interface ResolvedLogins {
[providerName: string]: string;
}
export type ResolvedLogins = Record<string, string>;
4 changes: 1 addition & 3 deletions packages/eventstream-marshaller/src/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export interface Message {
body: Uint8Array;
}

export interface MessageHeaders {
[name: string]: MessageHeaderValue;
}
export type MessageHeaders = Record<string, MessageHeaderValue>;

export interface BooleanHeaderValue {
type: "boolean";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ export interface PositiveTestVector {

export type TestVector = NegativeTestVector | PositiveTestVector;

export interface TestVectors {
[vectorName: string]: TestVector;
}
export type TestVectors = Record<string, TestVector>;
4 changes: 1 addition & 3 deletions packages/middleware-header-default/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { HttpRequest } from "@aws-sdk/protocol-http";
import { BuildHandler, BuildHandlerArguments, BuildMiddleware } from "@aws-sdk/types";

export interface HeaderDefaultArgs {
[header: string]: string;
}
export type HeaderDefaultArgs = Record<string, string>;

export function headerDefault(headerBag: HeaderDefaultArgs): BuildMiddleware<any, any> {
return (next: BuildHandler<any, any>) => {
Expand Down
4 changes: 1 addition & 3 deletions packages/types/src/eventStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export interface Message {
body: Uint8Array;
}

export interface MessageHeaders {
[name: string]: MessageHeaderValue;
}
export type MessageHeaders = Record<string, MessageHeaderValue>;

export interface BooleanHeaderValue {
type: "boolean";
Expand Down
8 changes: 2 additions & 6 deletions packages/types/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export interface Headers extends Map<string, string> {
* properties in favor of the other. The headers may or may not be combined, and
* the SDK will not deterministically select which header candidate to use.
*/
export interface HeaderBag {
[key: string]: string;
}
export type HeaderBag = Record<string, string>;

/**
* Represents an HTTP message with headers and an optional static or streaming
Expand All @@ -57,9 +55,7 @@ export interface HttpMessage {
* second being used when a parameter contains a list of values. Value can be set
* to null when query is not in key-value pairs shape
*/
export interface QueryParameterBag {
[key: string]: string | Array<string> | null;
}
export type QueryParameterBag = Record<string, string | Array<string> | null>;

export interface Endpoint {
protocol: string;
Expand Down
8 changes: 2 additions & 6 deletions packages/types/src/profile.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
export interface IniSection {
[key: string]: string | undefined;
}
export type IniSection = Record<string, string | undefined>;

/**
* @deprecated: Please use IniSection
*/
export interface Profile extends IniSection {}

export interface ParsedIniData {
[key: string]: IniSection;
}
export type ParsedIniData = Record<string, IniSection>;

export interface SharedConfigFiles {
credentialsFile: ParsedIniData;
Expand Down