Skip to content
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

fix: improved typing for $TSContext #11962

Merged
merged 56 commits into from
Feb 17, 2023

Conversation

sdstolworthy
Copy link
Contributor

@sdstolworthy sdstolworthy commented Feb 9, 2023

Description of changes

Adds additional typing for $TSContext.

As a general rule, types were not renamed unless there was a logical conflict or additional clarity was needed.
All types/interfaces used to define $TSContext were moved into amplify-cli-core.

In many cases across the codebase, nullable values are treated as non-nullable. In cases where this occurred, the type was defined as nullable, and null checks were added where needed. In cases where non-null assertions were removed and a null value would throw a type error in the existing code, a null check is added that specifically throws a type error.

Where possible, types and interfaces were moved to amplify-cli-core, and implementers are left in amplify-cli (or -auth).

Issue #, if available

Description of how you validated changes

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@sobolk sobolk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going into right direction I think.

packages/amplify-cli-core/src/types.ts Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Outdated Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Outdated Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Outdated Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Outdated Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Outdated Show resolved Hide resolved
packages/amplify-cli-core/src/types.ts Show resolved Hide resolved
@sdstolworthy sdstolworthy changed the title Typing for TSContext fix: improved typing for $TSContext Feb 14, 2023
@sdstolworthy sdstolworthy marked this pull request as ready for review February 15, 2023 23:11
@sdstolworthy sdstolworthy requested a review from a team as a code owner February 15, 2023 23:11
Copy link
Member

@sobolk sobolk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cli-internal - cli-core moves are looking good.
I am concerned about moving auth types to core.

Copy link
Member

@edwardfoyle edwardfoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple small comments but overall looks like a great step in the right direction!

Comment on lines 191 to 213
command: string;
subCommands?: string[];
options?: {
restore?: boolean;
json?: boolean;
name?: string;
awsInfo?: string;
config?: string;
'iterative-rollback'?: boolean;
force?: boolean;
env?: string;
rootStackName?: string;
frontend?: string;
quickstart?: boolean;
app?: string | boolean;
timeout?: string;
event?: string;
minify?: boolean;
help?: boolean;
localEnvFilePath?: string;
yes?: boolean;
appId?: string;
} & Record<string, string | boolean>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another vote in favor of defining this type as Record<string, string | boolean>

jhockett
jhockett previously approved these changes Feb 17, 2023
@sdstolworthy sdstolworthy merged commit 3e2ff00 into aws-amplify:dev Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants