diff --git a/packages/core/types/index.d.ts b/packages/core/types/index.d.ts index 2aea9cb5..27a28860 100644 --- a/packages/core/types/index.d.ts +++ b/packages/core/types/index.d.ts @@ -8,6 +8,7 @@ export { $$PropertyValue, $$ScaleValue, $$ThemeValue} from './css-util' export type CreateStitches = Config.CreateStitches export type CSSProperties = CSSUtil.CSSProperties export type DefaultThemeMap = Config.DefaultThemeMap +export type FontFace = CSSUtil.Native.AtRule.FontFace /** Returns a Style interface from a configuration, leveraging the given media and style map. */ export type CSS< diff --git a/packages/react/tests/types.test.tsx b/packages/react/tests/types.test.tsx index 1ea1f65d..4efcf255 100644 --- a/packages/react/tests/types.test.tsx +++ b/packages/react/tests/types.test.tsx @@ -1,6 +1,6 @@ // core types.tests.ts import * as Stitches from '../types/index' -import { createStitches } from '../types/index' +import { createStitches, FontFace } from '../types/index' const { css, globalCss, keyframes, styled, theme } = createStitches({ utils: { @@ -182,3 +182,24 @@ void function Test() { } + +/* ------------------------------------------------------------------------------------------------- + * Issue #1010 + * -----------------------------------------------------------------------------------------------*/ +const fontFaceArray: FontFace[] = [ + { + fontFamily: "Inter", + src: `url(file.woff2) format("woff2")`, + fontDisplay: "swap" + } +]; +const styles = { + "@font-face": fontFaceArray, + body: { + // Falbacking to a serif font so it's easier to see that the swap is hapenning + fontFamily: "Inter, serif" + } + }; +void function Test() { + globalCss(styles) +} diff --git a/packages/react/types/index.d.ts b/packages/react/types/index.d.ts index 8dbcc9ca..dedd0b09 100644 --- a/packages/react/types/index.d.ts +++ b/packages/react/types/index.d.ts @@ -8,6 +8,7 @@ export { $$PropertyValue, $$ScaleValue, $$ThemeValue } from './css-util' export type CreateStitches = Config.CreateStitches export type CSSProperties = CSSUtil.CSSProperties export type DefaultThemeMap = Config.DefaultThemeMap +export type FontFace = CSSUtil.Native.AtRule.FontFace /** Returns a Style interface from a configuration, leveraging the given media and style map. */ export type CSS<