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: tsType, type and markdownType #22

Merged
merged 7 commits into from
Nov 5, 2021
Merged

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Nov 1, 2021

This PR splits out tsType and markdownType (i.e. a human-readable type) from the schema type, because likely we can do useful operations on objects/arrays and other types when they are distilled into a smaller subset of possible types.

To produce markdownType, this PR uses @typedef to provide human-readable markdownType (and also provide a default markdown gloss for typeof import('some-library')['sometype'] or typeof import('some-library').sometype.

Example:

export const config = {
    /**
     * @typedef {false | true | 0 | 1} Booleanish
     * @type {Booleanish}
     */
    checked: false,
    dimensions: {
        /** @type {10 | 20} */
        width: 10,
        /** height in px */
        height: 10
    },
}

See playground.

@danielroe danielroe added the enhancement New feature or request label Nov 1, 2021
@danielroe danielroe requested a review from pi0 November 1, 2021 15:58
@danielroe danielroe self-assigned this Nov 1, 2021
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 1, 2021

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9d791f7
Status:⚡️  Build in progress...

View logs

@pi0 pi0 changed the title refactor: split out tsType, type and markdownType feat: tsType, type and markdownType Nov 5, 2021
@pi0 pi0 merged commit 10f989b into main Nov 5, 2021
@pi0 pi0 deleted the refactor/types-ts-js-markdown branch November 5, 2021 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants