[styled-components] Add test for TypeScript 3.7 break

This commit is contained in:
Jessica
2019-11-01 13:57:45 +09:00
parent 23ebe0869c
commit d59a388790

View File

@@ -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>
);