-
-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
I've set up twin macros with stitches following the examples but my styled-components export any type.
I was wondering if there's a way to type it so that I can autocomplete the props in VSCode
Here's my twin.d.ts
import "twin.macro";
import { css as cssImport } from "@stitches/react";
import styledImport from "@stitches/react";
// Support a css prop when used with twins styled.div({}) syntax
type CSSProp<T = AnyIfEmpty<DefaultTheme>> = string | CSSObject;
declare module "react" {
// The css prop
interface HTMLAttributes<T> extends DOMAttributes<T> {
css?: CSSProp;
tw?: string;
}
// The inline svg css prop
interface SVGProps<T> extends SVGProps<SVGSVGElement> {
css?: CSSProp;
tw?: string;
}
}
// Support twins styled.div({}) syntax
type StyledTags = {
[Tag in keyof JSX.IntrinsicElements]: CreateStyledComponent<
JSX.IntrinsicElements[Tag]
>;
};
declare module "twin.macro" {
// The styled and css imports
const styled: typeof StyledTags | typeof styledImport;
const css: typeof cssImport;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
