#1038·stitches

Compiling Stitches without "strict": true, causes massive performance issues

Author: andrewgeorgemitchellCreated Jun 9, 2022Updated Jan 8, 2026
Labelsbugtypescriptneeds investigation

Bug report

Describe the bug

When compiling Stitches in a TS environment without "strict": true in tsconfig.json the compile time will jump from a few seconds to multiple minutes (~200 seconds).

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

1 Clone Repo

2 Install deps

  • yarn install

3 Run TS compiler (will take ~160-200 seconds)

  • yarn tsc

4 Enable strict mode in tsconfig.json line 10

  • "strict": true,

5 Run TS compiler (will take ~4 seconds)

  • yarn tsc

Expected behavior

TS build should not take ~200 seconds

Screenshots

Screen shot of slow compile (169.41s): ('strict': false)

image

Screen shot of normal compile (4.00s): ('strict': true)

image

System information

  • OS: [macOS]
  • Browser (if applies) [N/A]
  • Version of Stitches: [1.2.8]
  • Version of Node.js: [16.x]
  • Version of Typescript: [4.6.x, 4.7.x] (tested both)

Additional context

Possible Cause & Interesting observation

The issue when not in strict mode seems to be that Typescript spends a large amount of time comparing CSS objects to each other, you can see this behaviour for yourself by:

  • commenting out line 71 in src/components/Text/Text.tsx
  • uncommenting line 72 in src/components/Text/Text.tsx