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(angular): Support strict: true #890

Merged
merged 11 commits into from
Dec 1, 2021
5 changes: 5 additions & 0 deletions .changeset/khaki-hounds-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aws-amplify/ui": patch
wlee221 marked this conversation as resolved.
Show resolved Hide resolved
---

fix(angular): Add first class support for `strict: true`
2 changes: 1 addition & 1 deletion examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AppComponent {

constructor() {
if (typeof window !== 'undefined') {
window['Amplify'] = Amplify;
(window as any)['Amplify'] = Amplify;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"module": "es2020",
"lib": ["es2018", "dom"],
"esModuleInterop": true,
"strict": true,
"paths": {
"@aws-amplify/ui-angular": ["../../packages/angular/dist/ui-angular"],
"@aws-amplify/ui-angular/*": ["../../packages/angular/dist/ui-angular/*"],
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/types/authMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface BaseFormContext {
}

export interface SignInContext extends BaseFormContext {
loginMechanisms: AuthContext['config']['loginMechanisms'];
socialProviders: AuthContext['config']['socialProviders'];
loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
socialProviders: Required<AuthContext>['config']['socialProviders'];
Comment on lines +31 to +32
Copy link
Contributor

Choose a reason for hiding this comment

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

Is adding Required going to cause any of the frameworks to complain if these props aren't passed into the authenticator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, because the parent machine have default values for loginMechanisms and socialProviders even if these props weren't passed by the end user:

loginMechanisms: loginMechanisms ?? cliLoginMechanisms,
signUpAttributes:
signUpAttributes ??
Array.from(
new Set([
...cliVerificationMechanisms,
...cliSignUpAttributes,
])
),

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

attributeToVerify?: string;
redirectIntent?: string;
unverifiedAttributes?: Record<string, string>;
Expand Down Expand Up @@ -69,8 +69,8 @@ export type SignUpAttribute =
| SignUpFieldsWithoutDefaults;

export interface SignUpContext extends BaseFormContext {
loginMechanisms: AuthContext['config']['loginMechanisms'];
socialProviders: AuthContext['config']['socialProviders'];
loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
socialProviders: Required<AuthContext>['config']['socialProviders'];
unverifiedAttributes?: Record<string, string>;
}

Expand Down