diff --git a/types/carbon-components-react/carbon-components-react-tests.tsx b/types/carbon-components-react/carbon-components-react-tests.tsx index cc94951b29..93db8196f7 100644 --- a/types/carbon-components-react/carbon-components-react-tests.tsx +++ b/types/carbon-components-react/carbon-components-react-tests.tsx @@ -8,6 +8,7 @@ import { TableHeader, TableRow, } from 'carbon-components-react'; +import Link from 'carbon-components-react/lib/components/UIShell/Link'; interface Row1 extends DataTableRow { rowProp: string; @@ -138,3 +139,29 @@ const t4 = ( }} /> ); + +// UIShell - Link +interface TestCompProps { + someProp: number, +} + +class TestComp1 extends React.Component { + render() { + return (
); + } +} + +const TestComp2 = (props: TestCompProps) => (
); + +const uisLinkT1 = ( + Test +); +const uisLinkT2 = ( + > element="img" src="src"/> +); +const uisLinkT3 = ( + element={TestComp1} someProp={2}>ASDF +); +const uisLinkT4 = ( + element={TestComp2} someProp={2}>ASDF +); diff --git a/types/carbon-components-react/lib/components/UIShell/HeaderMenu.d.ts b/types/carbon-components-react/lib/components/UIShell/HeaderMenu.d.ts index 6a59d6846c..23a7ae36ca 100644 --- a/types/carbon-components-react/lib/components/UIShell/HeaderMenu.d.ts +++ b/types/carbon-components-react/lib/components/UIShell/HeaderMenu.d.ts @@ -10,7 +10,7 @@ interface InheritedProps { } export interface HeaderMenuProps extends InheritedProps { - menuLinkName: string, + menuLinkName?: string, renderMenuContent?: React.FC, } diff --git a/types/carbon-components-react/lib/components/UIShell/Link.d.ts b/types/carbon-components-react/lib/components/UIShell/Link.d.ts index 583366f7e6..b542d40fc3 100644 --- a/types/carbon-components-react/lib/components/UIShell/Link.d.ts +++ b/types/carbon-components-react/lib/components/UIShell/Link.d.ts @@ -1,12 +1,16 @@ import * as React from "react"; import { ReactAnchorAttr, ShapeOf } from "../../../typings/shared"; -export interface LinkPropsBase { - element?: string, // required but has default value +type InnerElementProps

= Omit; +export interface LinkPropsBase

{ + element?: string | React.JSXElementConstructor>, // required but has default value } -export type LinkProps = ShapeOf; +export type LinkProps

= ShapeOf, P>; -declare function Link(props: React.PropsWithChildren>, ref: React.Ref): React.ReactElement; +declare function Link

( + props: React.PropsWithChildren>, + ref: React.Ref +): React.ReactElement; export default Link;