-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: some components are exported anonymously, which confuses TS some…
…how (#130) When we do `export default forwardRef(function Component(...))` the generated type definitions confuse TS, since all the components exported that way share the same _default namespace, thus the need to do: `const ComponentName = forwardRef(function ComponentName(...)); export default ComponentName`
- Loading branch information
Showing
9 changed files
with
33 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import React, { ForwardedRef, forwardRef } from "react"; | ||
import { LinkProps, StyledLink } from "./style"; | ||
|
||
const Link = (props: LinkProps, ref: ForwardedRef<HTMLAnchorElement>) => { | ||
const { sdsStyle } = props; | ||
let underline: LinkProps["underline"]; | ||
const Link = forwardRef( | ||
(props: LinkProps, ref: ForwardedRef<HTMLAnchorElement>) => { | ||
const { sdsStyle } = props; | ||
let underline: LinkProps["underline"]; | ||
|
||
if (sdsStyle === "default") { | ||
underline = "none"; | ||
} | ||
if (sdsStyle === "default") { | ||
underline = "none"; | ||
} | ||
|
||
return <StyledLink {...props} underline={underline} ref={ref} />; | ||
}; | ||
return <StyledLink {...props} underline={underline} ref={ref} />; | ||
} | ||
); | ||
|
||
export { LinkProps }; | ||
|
||
export default forwardRef(Link); | ||
export default Link; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters