Skip to content

Conversation

@prevwong
Copy link
Owner

This PR adds the ability for consumers to specify custom variable kinds:

Reka.create({
   kinds: {
      Color: {
          fallback: "#000",
          validate: field => field.string(value => isValidColor(value))
       }
   }
});

t.val({ 
  name: "color",
  kind: t.customKind({ name: "Color" }),
  init: t.literal({ value: "#000" })
});

// color: Color = "#000";

Note: Validation is not currently handled in this PR. Hence much of the APIs above are purely decorative at the moment.

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2023

🦋 Changeset detected

Latest commit: 3631849

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rekajs/parser Patch
@rekajs/types Patch
@rekajs/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Dec 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
reka ✅ Ready (Inspect) Visit Preview Dec 18, 2023 4:59pm

@prevwong prevwong force-pushed the implement-custom-kind branch from d31bc60 to 3631849 Compare December 18, 2023 16:55
@prevwong prevwong merged commit 52c4c8d into main Dec 18, 2023
@prevwong prevwong deleted the implement-custom-kind branch December 18, 2023 17:01
@github-actions github-actions bot mentioned this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants