vanilla-extract-css/vanilla-extract
View on GitHubtypescript: `defineProperties` throws `UnconditionalAtomicOptions` error when using long `responsiveArray`
Open
#1,080 opened on Apr 28, 2023
has-workaroundhelp wantedsprinklestype issue
Description
Describe the bug
When having 9 condition keys in defineProperties and listing them in order for responsiveArray, TypeScript throws the following error:
No overload matches this call.
The last overload gave the following error.
Argument of type '{ conditions: { sPhone: {}; phone: { '@media': string; }; lPhone: { '@media': string; }; sTablet: { '@media': string; }; tablet: { '@media': string; }; laptop: { '@media': string; }; desktop: { '@media': string; }; xDesktop: { ...; }; xlDesktop: { ...; }; }; defaultCondition: string; responsiveArray: string[]; prope...' is not assignable to parameter of type 'UnconditionalAtomicOptions<{ ... }>'.
Object literal may only specify known properties, and 'conditions' does not exist in type 'UnconditionalAtomicOptions<{ ... }>'.
Removing any entry from responsiveArray makes the error disappear and work as expected.
Reproduction
System Info
System:
OS: macOS 13.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 9.25 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
npm: 9.2.0 - ~/.nvm/versions/node/v18.12.1/bin/npm
Browsers:
Chrome: 112.0.5615.137
Safari: 16.4
npmPackages:
@vanilla-extract/css: ^1.11.0 => 1.11.0
@vanilla-extract/next-plugin: ^2.1.2 => 2.1.2
@vanilla-extract/recipes: ^0.4.0 => 0.4.0
@vanilla-extract/sprinkles: ^1.6.0 => 1.6.0
Used Package Manager
yarn
Logs
No overload matches this call.
The last overload gave the following error.
Argument of type '{ conditions: { sPhone: {}; phone: { '@media': string; }; lPhone: { '@media': string; }; sTablet: { '@media': string; }; tablet: { '@media': string; }; laptop: { '@media': string; }; desktop: { '@media': string; }; xDesktop: { ...; }; xlDesktop: { ...; }; }; defaultCondition: string; responsiveArray: string[]; prope...' is not assignable to parameter of type 'UnconditionalAtomicOptions<{ marginBottom: MapLeafNodes<{ 1: string; 2: string; 3: string; }, CSSVarFunction>; marginTop: MapLeafNodes<{ 1: string; 2: string; 3: string; }, CSSVarFunction>; }>'.
Object literal may only specify known properties, and 'conditions' does not exist in type 'UnconditionalAtomicOptions<{ marginBottom: MapLeafNodes<{ 1: string; 2: string; 3: string; }, CSSVarFunction>; marginTop: MapLeafNodes<{ 1: string; 2: string; 3: string; }, CSSVarFunction>; }>'.
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.