Skip to content

Commit

Permalink
Revert "feat: exported return types of 'stylex.types.*' fns (#867)"
Browse files Browse the repository at this point in the history
This reverts commit 02a93a0.
  • Loading branch information
necolas committed Jan 31, 2025
1 parent 00cc2f5 commit ea6722a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 29 deletions.
7 changes: 6 additions & 1 deletion packages/stylex/src/VarTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
* @flow strict
*/

import type { ValueWithDefault } from './util-types';
export type ValueWithDefault<+T> =
| T
| $ReadOnly<{
default: ValueWithDefault<T>,
[string]: ValueWithDefault<T>,
}>;

export type CSSSyntax =
| '*'
Expand Down
3 changes: 1 addition & 2 deletions packages/stylex/src/stylex.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
MapNamespaces,
} from './StyleXTypes';
import type {
ValueWithDefault,
Angle,
Color,
Url,
Expand All @@ -35,8 +36,6 @@ import type {
TransformFunction,
TransformList,
} from './VarTypes';
import type { ValueWithDefault } from './util-types';
export * as Types from './VarTypes';

export type {
VarGroup,
Expand Down
15 changes: 0 additions & 15 deletions packages/stylex/src/util-types.js

This file was deleted.

13 changes: 2 additions & 11 deletions packages/stylex/type-tests/theming1.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
/* eslint-disable no-unused-vars */

import * as React from 'react';
import * as stylex from '../src/stylex';
import stylexLegacy from '../src/stylex';
import stylex from '../src/stylex';
import type { StyleXVar, VarGroup, Theme } from '../src/StyleXTypes';

const DARK = '@media (prefers-color-scheme: dark)';
Expand Down Expand Up @@ -53,7 +52,7 @@ const correctTheme = stylex.createTheme(buttonTokens, {

correctTheme as Theme<typeof buttonTokens, string>;

const result: string = stylexLegacy(correctTheme);
const result: string = stylex(correctTheme);
const result2: $ReadOnly<{
className?: string,
style?: $ReadOnly<{ [string]: string | number }>,
Expand Down Expand Up @@ -142,14 +141,6 @@ const typedTokens = stylex.defineVars({
shortAnimation: stylex.types.time<string | 0>('0.5s'),
});

const _bgColor: StyleXVar<stylex.Types.Color<string>> = typedTokens.bgColor;
const _cornerRadius: StyleXVar<stylex.Types.Length<string | number>> =
typedTokens.cornerRadius;
const _translucent: StyleXVar<stylex.Types.Num<number>> =
typedTokens.translucent;
const _shortAnimation: StyleXVar<stylex.Types.Time<string | 0>> =
typedTokens.shortAnimation;

const correctlyTypedTheme = stylex.createTheme(typedTokens, {
bgColor: stylex.types.color('red'),
cornerRadius: stylex.types.length('4px'),
Expand Down

0 comments on commit ea6722a

Please sign in to comment.