GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — style(aio): enforce strict TypeScript checks by petebacondarwin · Pull Request #21342 · angular/angular Conversation
|
|
You can preview 78cebb9 at https://pr21342-78cebb9.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM 👍
Just a couple of nits and a linting error.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LoL
(Maybe move the first ! to the line above?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
if you insist
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't 😇
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How come tslint doesn't complain about Function. It usually prefers a specific function signature (e.g. () => void) 😃
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No idea but I changed it to VoidFunction just to keep you happy.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You can avoid the as any (here and below), by giving prop a type of keyof CSSStyleDeclaration (which also improves type-safety for the animateProp() function 🎉).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
not quite so simple since length and parentRule properties are readonly :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ooops 😞
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Arguably, this points out a bug in the code :-) I have put a check for those two properties.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Doesn't getNamedSvgIcon return an observable of SVGElements?
Is it for comparing with the result of createSvg()? Wouldn't it be more appropriate to "fix" createSvg() instead:
function createSvg(svgSrc) {
const div = document.createElement('div');
div.innerHTML = svgSrc;
- return div.querySelector('svg');
+ return div.querySelector<SVGElement>('svg')!;
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
+1
I fixed by relaxing the return type of createSvg(svgSrc: string): SVGElement
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be preferrable to have go(url?: string|null)? Do we need to explicitly pass undefined?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
So we do have explicit tests for each of these scenarios: https://github.com/angular/angular/blob/master/aio/src/app/shared/location.service.spec.ts#L272
But looking at the code, we never call with undefined or null so actually let's make it tighter.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the |undefined part?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think we do 😱 - perhaps I was being over-zealous!
Actually we have a test for this very scenario: https://github.com/angular/angular/blob/master/aio/src/app/shared/location.service.spec.ts#L339
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, the value type should be string|null|undefined.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, so as far as we use this we never pass null, so instead of relaxing the params type I am going to fix the use of double equals below this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit:
|undefined is somewhat confusing imo (and unnecessarily less strict - which is not a concern is tests of course). If it is just for avoiding the "used before being assigned" error, it might be more clear to initialize the value (e.g. let lastActiveItem: ScrollItem|null = null) or use ! when using it (e.g. expect(lastActiveItem!))?
(I understand this stems from TypeScript's current limitation to infer that a value might actual be set (through a synchronous function call) and falls under the "Super Nit" category, so feel free to ignore 😁)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, so initially I was concerned that we actually check that this value is null at the end of the test, so if none of the subscription handlers were called then this pass despite not being correct. But I now notice that before we check for it becoming null we check that it is some non-null value, so if none of the handler ran then the first expectation would fail before we get the false positive.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Missing space before string. (While you are at it, you can remove the double-space before => 😁)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
+1
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OOC, under what circumstances can a search result have no associated title?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Never :-) Or at least only if the data is bad.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If I understand Pete's comment correctly, this is blocked on #19795. right? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@IgorMinar : No, this is not blocked on #19795 but we just can't turn on the final |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d1aa41e to
40a4e68
Compare
|
You can preview d1aa41e at https://pr21342-d1aa41e.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You can preview 40a4e68 at https://pr21342-40a4e68.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
40a4e68 to
124c34e
Compare
|
You can preview 124c34e at https://pr21342-124c34e.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@petebacondarwin I see. that makes sense. thanks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM (as soon as CI is green 😃)
🎉
Sorry, something went wrong.
There was an error while loading. Please reload this page.
124c34e to
d133c0e
Compare
|
You can preview d133c0e at https://pr21342-d133c0e.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
oh I forgot about the e2e scripts |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d133c0e to
537e4d0
Compare
|
You can preview 537e4d0 at https://pr21342-537e4d0.ngbuilds.io/. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
File sizes were affected for some reason 😁 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Enable strictNullChecks mode for aio codebase
There was an error while loading. Please reload this page.