From 19f274b345371d2acfdebb9266bf680f30d0a439 Mon Sep 17 00:00:00 2001 From: Gavriel Mor <98694153+Gavriel-M@users.noreply.github.com> Date: Mon, 14 Jul 2025 16:55:12 +0300 Subject: [PATCH 1/2] Update units.ts --- packages/system/src/styles/units.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/system/src/styles/units.ts b/packages/system/src/styles/units.ts index 5d26c6e4..e623daf2 100644 --- a/packages/system/src/styles/units.ts +++ b/packages/system/src/styles/units.ts @@ -2,7 +2,7 @@ import { themeGetter } from '../style' import { px, ms, deg, rpx, percent } from '../unit' import { ITheme, Theme, ThemeNamespaceValue } from '../types' -export type Pixel = number | string +export type Pixel = (string & {}) | (number & {}) export const getPx = themeGetter({ name: 'px', transform: (value, { props }) => { From 50ab493a692d6c41ba43e0578060ab8c4a1e0d58 Mon Sep 17 00:00:00 2001 From: Gavriel Mor <98694153+Gavriel-M@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:20:27 +0300 Subject: [PATCH 2/2] Add internal documentation --- packages/system/src/styles/units.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/system/src/styles/units.ts b/packages/system/src/styles/units.ts index e623daf2..34b84582 100644 --- a/packages/system/src/styles/units.ts +++ b/packages/system/src/styles/units.ts @@ -2,6 +2,10 @@ import { themeGetter } from '../style' import { px, ms, deg, rpx, percent } from '../unit' import { ITheme, Theme, ThemeNamespaceValue } from '../types' +// Use `string & {}` and `number & {}` to avoid overriding IntelliSense suggestions +// in unions with theme tokens (e.g., 'sm', 'md'). This allows raw values but ensures +// theme tokens appear first in autocomplete. +// Ref: https://github.com/microsoft/TypeScript/issues/29729 export type Pixel = (string & {}) | (number & {}) export const getPx = themeGetter({ name: 'px',