feat(typing): add TypeScript typings and lint types, fixes #2720#3222
feat(typing): add TypeScript typings and lint types, fixes #2720#3222
Conversation
|
Deploy preview for web-dev-staging ready! Built with commit 057b4c0 |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. To prevent this from happening, leave a comment. |
|
@MichaelSolati did you mean for this to close? |
|
No.. i let it sit to long... |
a3ada4a to
e2e345c
Compare
7266a87 to
5e4042b
Compare
|
I've kept losing stuff and falling behind on keeping this up to date with the main branch that I thought we could just bring this in as it is now. Not all issues are resolved (about 185 typing issues exist), but it doesn't include the type linting in the lint command, so we can passively fix them as we change code. Also issues will still be highlighted in VS Code, but it wont fail our linting tests. I do need to go through the changes I've made and fix some stuff, but I think this could/should be wrapped up soon. |
632d44e to
7654118
Compare
|
Looks like GitHub actions is freezing up again, anyway... @robdodson and @samthor can you PTAL, lots of small changes which shouldn't break anything but should require scrutiny. @kaycebasques and @jpmedley I believe you've been tagged in because i renamed |
|
I think this PR also added a babel plugin for optional chaining which seems like an important addition to call out. I might prefer to add that in a separate PR and maybe we discuss the ramifications first. My main concern is if it makes it so things start silently failing where previously they caused errors that we could track down and file as bugs. |
robdodson
left a comment
There was a problem hiding this comment.
Looks good. Left a number of questions but I think we can land it tomorrow
| */ | ||
|
|
||
| declare global { | ||
| export interface WMouseEvent<T extends HTMLElement> extends MouseEvent { |
There was a problem hiding this comment.
Initially I thought this was referring to a mouse Wheel event.
Maybe the type could hint at why it's needed. Like MouseEventWithTarget or something like that?
There was a problem hiding this comment.
I was confused too but I actually really like this type. It seems like an obvious addition to Event.
There was a problem hiding this comment.
oh yeah I'm cool with adding the type, but I'm wondering if its name can be more descriptive. At a glance it's not clear what WMouseEvent means.
There was a problem hiding this comment.
I went with W as we use it as a prefix for our classes. I can rename it if there's a preference.
samthor
left a comment
There was a problem hiding this comment.
Sorry to pile on the nit-picks. I am really excited for this PR generally.
I am concerned about .?, I think we can make TS happy without it, but I accept that it could be quite difficult since the lifecycle of custom elements isn't great (their sub-elements will be null a lot of the time, while disconnected).
| */ | ||
|
|
||
| declare global { | ||
| export interface WMouseEvent<T extends HTMLElement> extends MouseEvent { |
There was a problem hiding this comment.
I was confused too but I actually really like this type. It seems like an obvious addition to Event.
17708bf to
bfca169
Compare
bfca169 to
0e55ce1
Compare
Alex Recommends ReportAlex recommends the following language changes, but Alex is a regular expression based algorithm, so take them with a grain of salt. src/site/content/en/handbook/author-profile/index.md
|
| if (changedProperties.has('switching') && this.switching) { | ||
| input.setSelectionRange(0, input.value.length); | ||
| input.focus(); | ||
| input?.setSelectionRange(0, input?.value.length); |
06dabcd to
99d9f03
Compare
057f635 to
057b4c0
Compare
Fixes #2720