1- import { Component as ReactComponent , ComponentClass , HTMLProps , ReactNode } from 'react' ;
1+ import {
2+ Component as ReactComponent ,
3+ type ComponentClass ,
4+ type HTMLProps ,
5+ type ReactNode ,
6+ } from 'react' ;
27
38/**
49Automatically binds your `Component` subclass methods to the instance.
@@ -89,7 +94,7 @@ Can be used to check if your component is running in the browser or if it's bein
8994*/
9095export const canUseDOM : boolean ;
9196
92- interface IfProps {
97+ type IfProps = {
9398 /**
9499 Condition to check. Children are only rendered if `true`.
95100 */
@@ -104,7 +109,7 @@ interface IfProps {
104109 If you need the children to not be evaluated when `condition` is `false`, pass a function to the `render` prop that returns the children.
105110 */
106111 readonly render ?: ( ) => ReactNode ;
107- }
112+ } ;
108113
109114/**
110115React component that renders the children if the `condition` prop is `true`.
@@ -139,7 +144,7 @@ import {If} from 'react-extras';
139144*/
140145export class If extends ReactComponent < IfProps > { }
141146
142- interface ChooseOtherwiseProps {
147+ type ChooseOtherwiseProps = {
143148 /**
144149 Children to render in the default case.
145150 */
@@ -149,7 +154,7 @@ interface ChooseOtherwiseProps {
149154 If you need the children to not be evaluated when a `<Condition.When>` component has a true condition, pass a function to the `render` prop that returns the children.
150155 */
151156 readonly render ?: ( ) => ReactNode ;
152- }
157+ } ;
153158
154159export class ChooseOtherwise extends ReactComponent < ChooseOtherwiseProps > { }
155160
@@ -213,7 +218,7 @@ export class Choose extends ReactComponent {
213218 static Otherwise : typeof ChooseOtherwise ;
214219}
215220
216- interface ForProps < T > {
221+ type ForProps < T > = {
217222 /**
218223 Items to iterate over. `render` will be called once per item.
219224 */
@@ -223,7 +228,7 @@ interface ForProps<T> {
223228 Returns the element to render corresponding to an `item`.
224229 */
225230 readonly render ?: ( item : T , index : number ) => ReactNode ;
226- }
231+ } ;
227232
228233/**
229234React component that iterates over the `of` prop and renders the `render` prop.
@@ -252,7 +257,7 @@ Or you could just use plain JavaScript:
252257*/
253258export class For < T > extends ReactComponent < ForProps < T > > { }
254259
255- interface ImageProps extends HTMLProps < HTMLImageElement > {
260+ type ImageProps = {
256261 /**
257262 URL of the image. Use instead of `src`.
258263 */
@@ -264,7 +269,7 @@ interface ImageProps extends HTMLProps<HTMLImageElement> {
264269 Default: Hide the image if it fails to load.
265270 */
266271 readonly fallbackUrl ?: string ;
267- }
272+ } & HTMLProps < HTMLImageElement > ;
268273
269274/**
270275React component that improves the `<img>` element.
@@ -285,7 +290,7 @@ It supports all the props that `<img>` supports, but you use the prop `url` inst
285290*/
286291export class Image extends ReactComponent < ImageProps > { }
287292
288- interface ElementClassProps {
293+ type ElementClassProps = {
289294 /**
290295 Classes to add to the root element.
291296
@@ -299,7 +304,7 @@ interface ElementClassProps {
299304 Either a single class or multiple classes separated by space.
300305 */
301306 readonly remove ?: string ;
302- }
307+ } ;
303308
304309/**
305310Renderless React component that can add and remove classes to the root `<html>` element. It accepts an `add` prop for adding classes, and a `remove` prop for removing classes. Both accept either a single class or multiple classes separated by space.
0 commit comments