Skip to content

Commit a34d035

Browse files
flying-sheepkeokilee
authored andcommitted
fix: Fix type for ref prop (#9)
`HTMLProps` is only intended for HTML Elements. `HTMLProps<AnElement>` means `HTMLAttributes<AnElement> & ClassAttributes<AnElement>` `ClassAttributes<T>` means something has a `ref: string | (instance: T) => any` property. A component wrapping an element (like ours) should therefore have props extending * `HTMLAttributes<WrappedElement>` (for the element props it passes on), and * `ClassAttributes<Wrapper>` (for the ref function `ref={wrapper => ...}`)
1 parent 5941b8c commit a34d035

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Component } from 'react';
44

5-
export interface WebViewProps extends React.HTMLProps<Electron.WebViewElement> {
5+
export interface WebViewProps extends React.HTMLAttributes<Electron.WebViewElement>, React.ClassAttributes<WebView> {
66
src: string
77

88
autosize?: boolean

0 commit comments

Comments
 (0)