-
Notifications
You must be signed in to change notification settings - Fork 44
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
Sidenav
- Convert to TypeScript
#2102
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
737486f
to
bd2f50b
Compare
2ce9f42
to
0b2194e
Compare
0b2194e
to
1cf492d
Compare
1cf492d
to
92c5bd2
Compare
92c5bd2
to
be66530
Compare
be66530
to
92a65d7
Compare
92a65d7
to
ea2b00b
Compare
…mponent and modifier that don’t have types exposed
69e0823
to
4ddca78
Compare
@alex-ju I've added a few comments, to continue the conversation. question: what do you think if we ask (again) if someone has different/better ideas in the ##proj-hds-ts-migration and/or #tech-modern-ember channels?
we're using https://github.com/simonihmig/ember-stargate/releases/tag/v0.5.0, which yes seems it should support 3.28, but maybe that's not the case (and I just noticed they released v0.6.0, which drops support for Ember < 4.12!) what do you think we should do? @meirish is back from PTO next week, should we wait? or try to debug and in case open an issue in the (I've also rebased, just in case) |
I'm totally up for us to ask around – I'm sure there are ways to make the Types stricter, but wanted to have a fallback to make sure we're not blocked. |
…for `ember-lts-3.28`
…lopment-types/global.d.ts` file as backstop solution
@alex-ju see my last two commits, let's see if they unblock the tests, and then we decide how to proceed |
} | ||
]; | ||
}; | ||
Element: HdsSideNavBaseSignature['Element']; |
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.
question: is there documentation somewhere that demonstrates how/why/when to do this kind of element definition specifically? I'm asking because I thought that this was constrained to the existing/valid HTML Element list, so I'm curious to learn more.
followup: thinking through this some more, this is saying "Element has already been defined/given a value, so use that already defined value here" which makes sense in TS land.
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.
Answering on the base of my limited knowledge/experience with TS: this is the way in which one "propagates" a known type across components/subcomponents: if component "A" is "consuming" a prop xyz
(let's say of type string
) from a component "B", in the signature of "A" we don't use string
, but a reference to the "B" prop (B[xyz]
). In this way, if in the future one needs to update xyz
in "B" to be string | number
, they don't have to remember to update manually the type also in the components (in our example "A") that consume the component "B", but it will be done automatically, because is already a reference to B[xyz]
. Makes sense?
This Element: HdsSideNavBaseSignature['Element'];
works exactly in this way.
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.
@alex-ju can you keep me honest on the above? 👆
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.
what Cristiano said is accurate; to help cascading/propagating types we oftentimes use the signature of the referenced component
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 don't think I see anything amiss. I agree we should figure out the stargate thing but we could also save that for after we're able to upgrade, maybe.
📌 Summary
Converts the
SideNav
component and subcomponents to TypeScript.Notice: because of failing tests for
ember-lts-3.28
it's not possible at the moment to upgradeember-stargate
package to0.5.0
, so we had to add loose typings forPortal/PortalTarget
.🔗 External links
Jira ticket: https://hashicorp.atlassian.net/browse/HDS-2711
👀 Component checklist
💬 Please consider using conventional comments when reviewing this PR.