Coder Social home page Coder Social logo

Comments (5)

rhys-vdw avatar rhys-vdw commented on September 25, 2024 1

All good, no expectation. Just gave the role in case you need to fix anything or I'm taking too long to merge something.

from ts-auto-guard.

aneilbaboo avatar aneilbaboo commented on September 25, 2024

Aha - I just noticed that this happens when there's an existing index.guard.ts file. Deleting the guard file and re-running ts-auto-guard results in the correct code being generated:

export function isRecursiveType(obj: any, _argumentName?: string): obj is RecursiveType {
    return (
        typeof obj === "object" &&
        Array.isArray(obj.children) &&
        obj.children.every((e: any) =>
            isRecursiveType(e) as boolean
        )
    )
}

export function isParentType(obj: any, _argumentName?: string): obj is ParentType {
    return (
        typeof obj === "object" &&
        obj.type === "parent" &&
        Array.isArray(obj.children) &&
        obj.children.every((e: any) =>
            isChildType(e) as boolean
        )
    )
}

export function isChildType(obj: any, _argumentName?: string): obj is ChildType {
    return (
        typeof obj === "object" &&
        obj.type === "child" &&
        isParentType(obj.parent) as boolean
    )
}

EDIT: Updated the title to reflect this.

from ts-auto-guard.

rhys-vdw avatar rhys-vdw commented on September 25, 2024

Woah, that's mystifying... I've just invited you to be a collaborator if you're interested as I am not actively working on this project.

from ts-auto-guard.

aneilbaboo avatar aneilbaboo commented on September 25, 2024

@rhys-vdw, cool - can't promise I will have results, but if I have some time, I'll take a look.

from ts-auto-guard.

aneilbaboo avatar aneilbaboo commented on September 25, 2024

Thx

from ts-auto-guard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.