Skip to content

Commit c9a3eac

Browse files
authored
fix(runtime): add height, width Source attrs (#4943)
add the height and width properties for the `SourceHTMLAttributes`. prior to this commit, users attempting to properly type a `<source/>` element in JSX would run into TypeScript errors: ```tsx render() { return <picture><source height={100} width={100}/></picture>; } ``` ``` [ ERROR ] TypeScript: src/components/my-component/my-component.tsx:31:29 Type '{ height: number; width: number; }' is not assignable to type 'SourceHTMLAttributes<HTMLSourceElement>'.Property 'height' does not exist on type 'SourceHTMLAttributes<HTMLSourceElement>'. L30: render() { L31: return <picture><source height={100} width={100}/></picture>; L32: } [26:05.7] build failed in 1.12 s ``` adding these typings as optional numbers resolves these types of compile-time errors fixes: #4942 STENCIL-977
1 parent b97dadc commit c9a3eac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/declarations/stencil-public-runtime.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,13 @@ export namespace JSXBase {
12591259
}
12601260

12611261
export interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
1262+
height?: number;
12621263
media?: string;
12631264
sizes?: string;
12641265
src?: string;
12651266
srcSet?: string;
12661267
type?: string;
1268+
width?: number;
12671269
}
12681270

12691271
export interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {

0 commit comments

Comments
 (0)