Skip to content

Add a promise schema builder #158

@andrewzolotukhin

Description

@andrewzolotukhin

Description

We lack a promise schema builder that will be resolved to a Promise<T> type.
Make sure you:

  1. follow best practices we have in the project
  2. Add comprehensive JSDoc comments
  3. Update .changeset
  4. Update README.md files
  5. Update website accordingly with playground
  6. don't forget to add unit tests and type test for every unit test.

Motivation / Use Case

Will be useful in a lot of cases. E.g. to define a function which returns promise as result.

Proposed API

import { promise, string } from '@cleverbrush/schema';

const PromiseResult = promise(string());

// PromiseResultType ==> Promise
type PromiseResultType = InferType;

Package

@cleverbrush/schema

Alternatives Considered

No response

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions