Skip to content

Navigation Menu

Sign in
Sign up

fontWeight type error #27

sillyleo started this conversation in General
Jan 17, 2023 · 4 comments · 6 replies
Discussion options

Hi, thanks for the library! I came from vanilla-extract to macaron for the friendlier setup and variant API.

However, I encountered an issue with typing:

image

image

Do you have any idea why I can't assign numbers to the fontWeights? Thanks

You must be logged in to vote

Replies: 4 comments 6 replies

Comment options

BTW is there docs for styleVariants?

You must be logged in to vote
1 reply
Comment options

I don't think so. But the styleVariants should work exactly like @vanilla-extract/css, so I guess their docs should help you:
https://vanilla-extract.style/documentation/api/style-variants/

Comment options

I mean, it doesn't work cuz that is not what the API is expecting, it expects something like this:

type Tokens = {
 [key: string]: string | Tokens;
};

You should just pass the values as strings and it'll work.

fontWeight: {
 normal: '400'
}
You must be logged in to vote
2 replies
Comment options

Thanks! Exactly what I did later.

I found it's by design like this: vanilla-extract-css/vanilla-extract#314 (possibly related?)

Comment options

Totally

Comment options

Hey @sillyleo, font weight should be a string as recommended by @p7gg

You must be logged in to vote
0 replies
Comment options

Hi @Mokshit06 thanks again. Would like to hear your suggestion on the best way to type a component.

Issue

https://github.com/sillyleo/nomimono/blob/main/src/Button/index.tsx

In my setup here, the vite plugin I used to generate/infer type doesn't work. (config)

image

The type does work in local env (I can get auto-completion and checking). However, the published package doesn't have that.

Is there a recommended setup? For example, import some type definition and extend the type with my own props like Stitches?

Thank!

You must be logged in to vote
3 replies
Comment options

Hey, thanks for reporting this! macaron doesn't publish types for generated component, though I should add that. It'll get fixed today

Comment options

Oh yes!!

Comment options

So I looked into this issue and it looks like it will require VE to update some of their internal types. If it gets fixed within a few days then I'll upstream it to macaron, or just reimplement that type for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /