segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

MenuItem secondaryText propType doesn't accept string #1390

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

Looks like the secondaryText propType for Menu.Item resolves to JSX.Element | undefined, but this doesn't allow for strings to be passed without casting. This is a bit misleading, especially since our examples include strings for this prop.

Type 'string' is not assignable to type 'Element | undefined'.ts(2322)
index.d.ts(1494, 3): The expected type comes from property 'secondaryText' which is declared here on type 'IntrinsicAttributes & Without<EnhancerProps, keyof MenuItemOwnProps> & { is?: "div" | undefined; allowUnsafeHref?: boolean | undefined; } & Without<...> & MenuItemOwnProps'

See Code Sandbox for a reproduction.