File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,19 +135,24 @@ <h3>2. Use in JSX</h3>
135135
136136 < h3 > 3. Optional: TypeScript support</ h3 >
137137 < p >
138- Add a type declaration so TypeScript recognises the element in JSX:
138+ Add a type declaration so TypeScript recognises the elements in JSX.
139+ This form works with both React 18 and React 19:
139140 </ p >
140141< pre > < code > < span class ="comment "> // bitrise-navigation.d.ts</ span >
141- < span class ="kw "> declare namespace</ span > JSX {
142- < span class ="kw "> interface</ span > < span class ="component "> IntrinsicElements</ span > {
143- < span class ="str "> 'bitrise-navigation'</ span > : React.DetailedHTMLProps<
144- React.HTMLAttributes<HTMLElement> & { < span class ="attr "> position</ span > ?: < span class ="str "> 'sticky'</ span > | < span class ="str "> 'static'</ span > | < span class ="str "> 'smart'</ span > },
145- HTMLElement
146- >;
147- < span class ="str "> 'bitrise-footer'</ span > : React.DetailedHTMLProps<
148- React.HTMLAttributes<HTMLElement>,
149- HTMLElement
150- >;
142+ < span class ="kw "> import</ span > < span class ="str "> 'react'</ span > ;
143+
144+ < span class ="kw "> declare module</ span > < span class ="str "> 'react'</ span > {
145+ < span class ="kw "> namespace</ span > JSX {
146+ < span class ="kw "> interface</ span > < span class ="component "> IntrinsicElements</ span > {
147+ < span class ="str "> 'bitrise-navigation'</ span > : React.DetailedHTMLProps<
148+ React.HTMLAttributes<HTMLElement> & { < span class ="attr "> position</ span > ?: < span class ="str "> 'sticky'</ span > | < span class ="str "> 'static'</ span > | < span class ="str "> 'smart'</ span > },
149+ HTMLElement
150+ >;
151+ < span class ="str "> 'bitrise-footer'</ span > : React.DetailedHTMLProps<
152+ React.HTMLAttributes<HTMLElement>,
153+ HTMLElement
154+ >;
155+ }
151156 }
152157}</ code > </ pre >
153158
You can’t perform that action at this time.
0 commit comments