mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[styled-components] Add test for TypeScript 3.7 break
This commit is contained in:
@@ -714,6 +714,24 @@ async function typedThemes() {
|
||||
${themedCssWithNesting}
|
||||
`;
|
||||
|
||||
const WithProp = styled.div`
|
||||
${({ ok, theme: { color } }: { ok: boolean; theme: typeof theme }) =>
|
||||
ok &&
|
||||
css`
|
||||
color: ${color};
|
||||
`}
|
||||
`;
|
||||
|
||||
// TS 3.7 note: this breaks when FlattenInterpolation is an interface,
|
||||
// it needs to be made a recursive type to fix.
|
||||
const WithPropNested = styled.div`
|
||||
${({ ok }: { ok: boolean }) =>
|
||||
ok &&
|
||||
css`
|
||||
color: ${({ theme: { color } }: { theme: typeof theme }) => color};
|
||||
`}
|
||||
`;
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<>
|
||||
@@ -728,6 +746,8 @@ async function typedThemes() {
|
||||
return theme.color;
|
||||
}}
|
||||
</ThemeConsumer>
|
||||
<WithProp ok />
|
||||
<WithPropNested ok />
|
||||
</>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user