Skip to content
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

[Link & Button] Refactor tag pattern for better typings #8264

Open
1 of 5 tasks
geospatialem opened this issue Nov 27, 2023 · 0 comments
Open
1 of 5 tasks

[Link & Button] Refactor tag pattern for better typings #8264

geospatialem opened this issue Nov 27, 2023 · 0 comments
Labels
0 - new New issues that need assignment. calcite-components Issues specific to the @esri/calcite-components package. estimate - 3 A day or two of work, likely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. p - low Issue is non core or affecting less that 10% of people using the library refactor Issues tied to code that needs to be significantly reworked.

Comments

@geospatialem
Copy link
Member

Description

Refactor the tag pattern for both the link and button components:

const Tag = /.../
<Tag ... />

There are no current ESLink rules we can leverage, however we could explore a custom rule.

Proposed Advantages

  • Better typescript typings

Which Component

  • link
  • button

Relevant Info

Came up while discussing #8140

Addition research notes from @jcfranco:

Latest TypeScript shows the same thing. I think we don't get any warnings because of how the JSX type is constructed:

TS2322: Type  { doesNotExist: true; href: string; }  is not assignable to type
AnchorHTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLDivElement>
Property  doesNotExist  does not exist on type
AnchorHTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLDivElement>

If you notice, AnchorHTMLAttributes<HTMLAnchorElement> & HTMLAttributes<HTMLDivElement> is an intersection and not a union, so it allows attr/props from either type. If you try any extraneous attr/prop, it will complain (as the above error shows).

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components
@geospatialem geospatialem added refactor Issues tied to code that needs to be significantly reworked. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Nov 27, 2023
@github-actions github-actions bot added the calcite-components Issues specific to the @esri/calcite-components package. label Nov 27, 2023
@geospatialem geospatialem added p - low Issue is non core or affecting less that 10% of people using the library estimate - 3 A day or two of work, likely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. calcite-components Issues specific to the @esri/calcite-components package. estimate - 3 A day or two of work, likely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. p - low Issue is non core or affecting less that 10% of people using the library refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

No branches or pull requests

1 participant