Skip to content

Satifies keyword breaks constant object replacement #394

@Mad-Kat

Description

@Mad-Kat

When using an object with satisfies the resolver isn't able to inject a constant at build time:

type Size = "tiny" | "small" | "medium" | "huge";

export const sizes = {
  tiny: 16,
  small: 24,
  medium: 40,
  huge: 96
} satisfies Record<Size, number>;

// imported in another file:
const Button = styled.div`
  height: ${sizes.huge};
`;

fails with:

Error resolving cross-file selectors: Error resolving from module sizes.ts: Error unpacking Record/Array - unexpected exportValue "unsupported" for specifier "sizes.huge" Extracted values: { "sizes": { "type": "unsupported", "hint": "TSSatisfiesExpression" } }

Playground link

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions