How to transform string values from Figma before passing them to `example`?
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- figma, typescript
- Domaine
- developer-experience, tooling
Piste de recherche
Start by reading the Code Connect documentation and the prop mapping behavior around figma.string and example; the issue provides a reproduction using an Errors component that expects a string array. Determine whether transforming mapped values is supported or needs a new API, then confirm the expected generated output for the reproduction. Done means the supported path is documented or the limitation and roadmap status are clarified.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Is there a way to perform operations on the prop values coming from Figma, before they're passed to example?
My scenario is as follows:
- We have an
Errorscomponent that accepts an array of error messages (as strings), ie.<Errors errors={['Error 1', 'Error 2']} /> - The design component in Figma has a single
textproperty, where the error messages are specified
Currently I have the following in my Code Connect file:
import figma from '@figma/code-connect';
import { Errors } from 'src/components';
figma.connect(
Errors,
'[redacted]',
{
props: {
errors: figma.string('text'), // I'd like to transform this to an array, ie. `[figma.string('text')]`
},
example: ({ errors }) => <Errors errors={errors} />,
},
);
Since the Errors component only accepts an array of strings, and not a single string, the above doesn't work. I need to be able to put figma.string('text') into an array, however nothing I tried seems to work.
If I do the following, then Figma renders it as-is, without using the actual value of errors:
example: ({ errors }) => <Errors errors={[errors]} />,
And if I try putting figma.string('text') into an array before passing it to example, then I get <Errors errors={[undefined]} /> output in Figma.
Is there a way to accomplish this? If not currently, is this something that is on the roadmap? Not being able to perform operations on the values coming from Figma is pretty limiting IMO.
Code Connect version: 1.3.5
OS: MacOS 26 (Tahoe)
- Langage dominant
- TypeScript
- Étoiles
- 1.6k
- Forks
- 126
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de figma/code-connect
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffixOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
figma/code-connect#419 ·
-
feature request
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
figma/code-connect#403 ·
-
feature request
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
figma/code-connect#414 ·
-
feature request
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
figma/code-connect#413 · 1 commentaire ·
-
feature request
Difficulté 4/5 3-5 jours Accessibilité débutants 54/100
figma/code-connect#412 · 1 commentaire ·
Toutes les issues de figma/code-connect
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
vercel-labs/ui#540 ·
Les mainteneurs répondent en général sous 1 jour
-
accepted ai-dev ai-implementing
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
livesport/homer#218 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Negative values skip k/M abbreviation and medium decimal format on line, stacked-area, and tooltipOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
britecharts/britecharts#1255 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
Les mainteneurs répondent en général sous 1 jour