Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to specify custom kinds #118

Merged
merged 1 commit into from
Dec 18, 2023
Merged

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.

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

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 merged commit 52c4c8d into main Dec 18, 2023
1 check passed
@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.

1 participant