-
Notifications
You must be signed in to change notification settings - Fork 11
Upgrade to v14 #2105
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
Upgrade to v14 #2105
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -164,19 +164,17 @@ describe('Explorer component', () => { | |||
limit: 1000, | |||
interval: new TimeDuration(15, TimeUnit.Second) | |||
}), | |||
expect.objectContaining({}) | |||
undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like something is broken? It used to be called with an object and now we're saying it's undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i am not sure if the tests were working as intended before. I will double check this page to see if there is any issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like the only outstanding issue. If they were returning an object before and now returning undefined, something's been functionally changed. It may be on the test side, may be on the component side but seems like we should understand this issue before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested this and things seem to work as expected. Not seeing any issues at all. Imo, we can go ahead with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow up on it - something's clearly broken, sounds like it's on the test side.
@@ -8,7 +8,7 @@ export class CartesianNoDataMessage { | |||
|
|||
public constructor( | |||
private readonly hostElement: Element, | |||
private readonly series: Series<{}>[], | |||
private readonly series: Series<unknown>[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scratch that. This is the error we get from the new ts
Argument of type 'Series<TData>[]' is not assignable to parameter of type 'Series<{}>[]'.
Type 'Series<TData>' is not assignable to type 'Series<{}>'.
Type 'TData' is not assignable to type '{}'.ts(2345)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding a bound on the definition, Series<TInterval>
would resolve that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
umm.. may be, but unknown makes sense to me here. No data doesn't need to know the generic type of series data. I can define TInterval, but i think i will also have to default to unknown or always pass a type from the caller side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the context of the larger review, didn't look where we were. Agree, no data doesn't care (i.e. doesn't make any assumptions that it's an object) and as long as it works with unknown it's fine.
projects/observability/src/shared/components/utils/d3/zoom/d3-zoom.ts
Outdated
Show resolved
Hide resolved
@@ -123,8 +123,10 @@ export class EntityTopologyGraphQlQueryHandlerService | |||
} | |||
} | |||
|
|||
public convertResponse(response: TopologyServerResponse, request: GraphQlEntityTopologyRequest): EntityNode[] { | |||
return this.convertToEntityNodes(request, response.results); | |||
public convertResponse(response: unknown, request: GraphQlEntityTopologyRequest): EntityNode[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did this lose typing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have used this pattern at a few places. We tend to avoid exporting "server" types from the handler but in this case, we must export them if we want the tests to be able to call this method.
Here is an example:
public convertResponse(response: unknown, request: GraphQlEntitiesQueryRequest): Observable<EntitiesResponse> {
return this.entitiesGraphQlQueryBuilderService.buildResponse(response, request);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just export TopologyServerResponse
from this file, if we want to use it in the test?
If we are worried about exposing an interface outside of a module, we should just not export the interface in a public-api.ts or index.ts file in the module/project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we must export them if we want the tests to be able to call this method.
I thought it should work as long as we don't need a direct type reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It complains. Probably because we didn't pass all properties. I didn't want to debug and change this in the code as part of this PR. Do you mind if we address all similar occurrences in a new PR?
tsconfig.json
Outdated
"baseUrl": "./", | ||
"importHelpers": true, | ||
"outDir": "./dist/out-tsc", | ||
"strict": true, | ||
"sourceMap": true, | ||
"declaration": false, | ||
"module": "es2020", | ||
"target": "es2015", | ||
"target": "es2020", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is changing the target required? Just curious why we're doing it now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted. But ng automatically had changed it to target": "ES2021",
. Should we move to the new target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have to go through compatibility - it doesn't really matter to us since TS handles the down-compilation, so no harm (other than missed optimizations) in targeting the older version with more compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, what about .browserlistrc
? Just by virtue of updating Angular, we are limiting browser support to the most recent browsers at the time of Angular 14's release (Q2 2022). (See browserlist).
IMO we should update this to ES2021 or ES2020, and we should check for compatibility after updating Angular anyways, regardless of any internal SLA that might be different than Angular's (which is "the most recent browsers", presumably when Angular 14 was released last year).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should decouple this one from the current PR. I will do some research and take your concern into account and put a new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, decouple. There's a difference in angular (and our) published SLA and best effort. Like there's no way angular actually only supports the last 2 versions of chrome (i.e. the march and april releases, but not feb), or other evergreens. That's just what they're putting in writing. We've got to be careful with older support given the nature of larger enterprise users and slower upgrade cadences.
@aaron-steinfeld updated. |
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## main #2105 +/- ##
===========================================
- Coverage 83.11% 40.77% -42.35%
===========================================
Files 905 905
Lines 19974 19769 -205
Branches 2861 3052 +191
===========================================
- Hits 16602 8061 -8541
- Misses 3221 11195 +7974
- Partials 151 513 +362
... and 412 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how thorough we want to be with this PR in the interest of time. Since we are bumping TypeScript by five minor versions, I took a look at the changelog blogposts:
- https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/
- https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/
- https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/
- https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/
- https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/
The first section of the 4.4 update mentions that TS can now detect if a constant value contains a type guard, so we could improve confirmation-modal.component.ts:
this.isContentString = isString(config.content);
if (isString(config.content)) {
// calling isString twice is now redundant, we can replace the second call with:
if (this.isContentString) {
There are probably more. If our goal is just to bump the version up to catch up, then that's okay too.
@@ -123,8 +123,10 @@ export class EntityTopologyGraphQlQueryHandlerService | |||
} | |||
} | |||
|
|||
public convertResponse(response: TopologyServerResponse, request: GraphQlEntityTopologyRequest): EntityNode[] { | |||
return this.convertToEntityNodes(request, response.results); | |||
public convertResponse(response: unknown, request: GraphQlEntityTopologyRequest): EntityNode[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just export TopologyServerResponse
from this file, if we want to use it in the test?
If we are worried about exposing an interface outside of a module, we should just not export the interface in a public-api.ts or index.ts file in the module/project.
tsconfig.json
Outdated
"baseUrl": "./", | ||
"importHelpers": true, | ||
"outDir": "./dist/out-tsc", | ||
"strict": true, | ||
"sourceMap": true, | ||
"declaration": false, | ||
"module": "es2020", | ||
"target": "es2015", | ||
"target": "es2020", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, what about .browserlistrc
? Just by virtue of updating Angular, we are limiting browser support to the most recent browsers at the time of Angular 14's release (Q2 2022). (See browserlist).
IMO we should update this to ES2021 or ES2020, and we should check for compatibility after updating Angular anyways, regardless of any internal SLA that might be different than Angular's (which is "the most recent browsers", presumably when Angular 14 was released last year).
Yeah, these are some things we should do with follow up PRs. We will also have to do similar upgrades for angular related code. |
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-jsdoc": "40.0.0", | ||
"eslint-plugin-no-null": "1.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we install this, but then remove all the comments from tslint that enable this behavior?
// tslint:disable-next-line: no-null-keyword
I think we don't actually need to install this plugin if we removed all the comments.
Also, FWIW, I think allowing the null
keyword is a great thing.
We should bump the version in its own PR (obviously, this one's huge already), then we can go through and see what features we can take advantage of. Would be good to spend some time on weekly call going over the new features available.
I thought we had just replaced the tslint disable overrides with equivalent eslint overrides? It's still on by default right
Separate discussion, we should try to migrate as-is then we can consider rules changes. I disagree, but certainly open to debate! |
I remember updating Angular in the past and running into issues when changing the version of typescript that the auto update tool suggested. I think I would personally rather have the stronger typing from the newer version of TypeScript sooner, and then go back and look at improvements that we missed later. We could create some tasks to look for improvements from each minor version of TypeScript. @anandtiwary has already taken care of the breaking changes that throw compile-time errors, which is the difficult part.
It would be great if we could have a linter rule smart enough to see when we are providing |
Description
Please include a summary of the change, motivation and context.
Testing
Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.
Checklist:
Documentation
Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.