Make Link.to and Button.to more strict
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-components': minor
|
||||
---
|
||||
|
||||
Made the `to` prop of `Button` and `Link` more strict, only supporting plain strings. It used to be the case that this prop was unexpectedly too liberal, making it look like we supported the complex `react-router-dom` object form of the parameter as well, which led to unexpected results at runtime.
|
||||
@@ -613,8 +613,9 @@ export const Link: (props: LinkProps) => JSX.Element;
|
||||
// Warning: (ae-missing-release-tag) "LinkProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type LinkProps = LinkProps_2 &
|
||||
LinkProps_3 & {
|
||||
export type LinkProps = Omit<LinkProps_2, 'to'> &
|
||||
Omit<LinkProps_3, 'to'> & {
|
||||
to: string;
|
||||
component?: ElementType<any>;
|
||||
noTrack?: boolean;
|
||||
};
|
||||
|
||||
@@ -47,8 +47,9 @@ const useStyles = makeStyles(
|
||||
|
||||
export const isExternalUri = (uri: string) => /^([a-z+.-]+):/.test(uri);
|
||||
|
||||
export type LinkProps = MaterialLinkProps &
|
||||
RouterLinkProps & {
|
||||
export type LinkProps = Omit<MaterialLinkProps, 'to'> &
|
||||
Omit<RouterLinkProps, 'to'> & {
|
||||
to: string;
|
||||
component?: ElementType<any>;
|
||||
noTrack?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user