Skip to content

chore: upgrade to angular v16#62

Merged
mnahkies merged 3 commits intomasterfrom
mn/chore/upgrade-angular
May 4, 2023
Merged

chore: upgrade to angular v16#62
mnahkies merged 3 commits intomasterfrom
mn/chore/upgrade-angular

Conversation

@mnahkies
Copy link
Copy Markdown
Owner

@mnahkies mnahkies commented May 4, 2023

  • use ng new to re-create from standard template

  • switch to plain css instead of scss, we're not interested in styles for these tests

  • upgrade to typescript v5 everywhere

mnahkies added 3 commits May 4, 2023 11:54
- use ng new to re-create from standard template

- switch to plain css instead of scss, we're not interested in styles
  for these tests

- upgrade to typescript v5 everywhere
HttpParams is immutable, and so previously the query parameter handling
didn't work at all.

Now it has an expanded type to support the stripe client, and also
correctly returns the final object.

However, it does not yet support array or objects passed as a query
parameter and will throw an exception if this happens.
if (value !== undefined && value !== null) {
result.set(name, String(value))
private _queryParams(queryParams: QueryParams): HttpParams {
return Object.entries(queryParams).reduce((result, [name, value]) => {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Turns out that the HttpParams object is immutable, and so this was previously totally broken.

ref: https://angular.io/api/common/http/HttpParams#description

This class is immutable; all mutation operations return a new instance.

}
})
return result
throw new Error(
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Getting the behavior right for array and object types is tricky. Throw an exception for now to allow the QueryParams type to still accept them to make the stripe code happy and come back to it later

@mnahkies mnahkies marked this pull request as ready for review May 4, 2023 12:07
@mnahkies mnahkies enabled auto-merge (squash) May 4, 2023 12:07
@mnahkies mnahkies merged commit 087a1bb into master May 4, 2023
@mnahkies mnahkies deleted the mn/chore/upgrade-angular branch May 4, 2023 12:09
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.

1 participant