-
Notifications
You must be signed in to change notification settings - Fork 75
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
refactor: fixup typescript errors #10295
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ import { | |
import { componentOnReady } from "../../utils/component"; | ||
import { SLOTS as PANEL_SLOTS } from "../panel/resources"; | ||
import { HeadingLevel } from "../functional/Heading"; | ||
import { OverlayPositioning } from "../../components"; | ||
import type { OverlayPositioning } from "../../utils/floating-ui"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since components.d.ts will be deleted, I'm changing this to import from the actual origin |
||
import { DialogMessages } from "./assets/dialog/t9n"; | ||
import { | ||
CSS, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import { FunctionalComponent, h, VNode } from "@stencil/core"; | |
import { JSXAttributes } from "@stencil/core/internal"; | ||
import { FloatingLayout } from "../../utils/floating-ui"; | ||
|
||
interface FloatingArrowProps extends JSXAttributes { | ||
interface FloatingArrowProps extends JSXAttributes<SVGSVGElement> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this way |
||
floatingLayout: FloatingLayout; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { newE2EPage } from "@stencil/core/testing"; | ||
import { accessible, disabled, hidden, renders, themed, t9n } from "../../tests/commonTests"; | ||
import { HandleMessages } from "../../components"; | ||
import type { HandleMessages } from "./assets/handle/t9n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rearrangement causes an If you have a custom There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, interesting that pre-commit hook didn't catch this. maybe my node_modules was out of date 🤔 |
||
import { CSS, SUBSTITUTIONS } from "./resources"; | ||
|
||
describe("calcite-handle", () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,9 @@ export class Link implements InteractiveComponent, LoadableComponent { | |
When the 'download' property of type 'boolean | string' is set to true, the value is "". | ||
This works around that issue for now. | ||
*/ | ||
download={Tag === "a" && (download === "" || download) ? download : null} | ||
download={ | ||
Tag === "a" ? (download === true || download === "" ? "" : download || null) : null | ||
} | ||
href={Tag === "a" && this.href} | ||
onClick={this.childElClickHandler} | ||
ref={this.storeTagRef} | ||
|
@@ -174,7 +176,7 @@ export class Link implements InteractiveComponent, LoadableComponent { | |
/** the rendered child element */ | ||
private childEl: HTMLAnchorElement | HTMLSpanElement; | ||
|
||
private childElClickHandler = (event: PointerEvent): void => { | ||
private childElClickHandler = (event: MouseEvent): void => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onClick emits MouseEvent, not PointerEvent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, this might change in the near future since Chrome and Firefox already emit pointer events, and it looks like Safari will soon (adhering to the updated spec). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the fyi. For the future, I am looking to automate the process of keeping Lumina's JSX typings up to date with the web platform to fix the DX issue we are having with Maquette and Stencil. |
||
if (!event.isTrusted) { | ||
// click was invoked internally, we stop it here | ||
event.stopPropagation(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -700,7 +700,7 @@ export class Panel | |
}; | ||
|
||
render(): VNode { | ||
const { disabled, loading, panelKeyDownHandler, isClosed } = this; | ||
const { disabled, loading, isClosed } = this; | ||
|
||
const panelNode = ( | ||
<article | ||
|
@@ -718,7 +718,7 @@ export class Panel | |
); | ||
|
||
return ( | ||
<Host onKeyDown={panelKeyDownHandler}> | ||
<Host onKeyDown={this.panelKeyDownHandler}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. noop change, but this makes it easy for the codemod to refactor-out I earlier mentioned that special utils would be needed to replace |
||
<InteractiveContainer disabled={disabled}> | ||
{loading ? <calcite-scrim loading={loading} /> : null} | ||
{panelNode} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,7 +268,7 @@ export class Popover | |
|
||
@State() defaultMessages: PopoverMessages; | ||
|
||
arrowEl: SVGElement; | ||
arrowEl: SVGSVGElement; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the correct type for the |
||
|
||
closeButtonEl: HTMLCalciteActionElement; | ||
|
||
|
@@ -515,7 +515,7 @@ export class Popover | |
deactivateFocusTrap(this); | ||
} | ||
|
||
storeArrowEl = (el: SVGElement): void => { | ||
storeArrowEl = (el: SVGSVGElement): void => { | ||
this.arrowEl = el; | ||
this.reposition(true); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,7 +356,7 @@ export class Rating | |
} | ||
}; | ||
|
||
private handleInputChange = (event: InputEvent) => { | ||
private handleInputChange = (event: Event) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onChange emits Event |
||
if (this.isKeyboardInteraction === true) { | ||
const inputVal = Number(event.target["value"]); | ||
this.hoverValue = inputVal; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { | |
|
||
@State() floatingLayout: FloatingLayout = "vertical"; | ||
|
||
arrowEl: SVGElement; | ||
arrowEl: SVGSVGElement; | ||
|
||
guid = `calcite-tooltip-${guid()}`; | ||
|
||
|
@@ -344,7 +344,7 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { | |
> | ||
<FloatingArrow | ||
floatingLayout={floatingLayout} | ||
ref={(arrowEl: SVGElement) => (this.arrowEl = arrowEl)} | ||
ref={(arrowEl) => (this.arrowEl = arrowEl)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no longer need to type this here now that FloatingArrow ref type is typed correctly |
||
/> | ||
<div class={CSS.container}> | ||
<slot /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { Rule } from "eslint"; | ||
// @ts-ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PSA: do not use Safer alternative: |
||
import { stencilComponentContext } from "stencil-eslint-core"; | ||
|
||
const rule: Rule.RuleModule = { | ||
|
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.
with this change, when
this.download
istrue
, we set the prop as""
instead.not required for Stencil, but this is needed for Lit as
download
attribute is typed asstring
rather thanstring | boolean
in Lumina for technical reasons (it's one few such special attributes for legacy dom reasons)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 needs to be updated or reverted. It breaks this test.
This change changes how the internal element's
download
attribute is applied.before
after